
so i have document named "uploads" and "users" both are in one way relation so i want to assign the upload to a particular user help me in that pls

Let's say your users is like this
{
name: ""
uploads: {
upload_file: ""
}
}
Then you can do this
await databases.createDocument(
DB_ID,
COLLECTION_ID,
ID.unique(),
{
name: 'Spiderman',
uploads: [
{ upload_file: 'file'},
{ upload_file: 'file2'},
]
}
)

specially on this func types
async function CreateUpload(msgId: string, fileId: string, fileSize: string, botType: string) {
const promise = AppwriteDB.createDocument(
process.env.APPWRITE_DATABASE_ID! || "65d4e2cb945b18ce913c",
"65d4e325a9a679460393",
fileId,
{ msgId: msgId, fileId: fileId, fileSize: fileSize, name: msgId, botType: botType }
);
promise.then(
function (response) {
return response;
},
function (error) {
console.log(error);
}
);
}```

can you refer to this

I don't see relationship in your code

user is already created just i want that when the user will upload any file

What is the field of the user?

it will be in relation to it
Recommended threads
- No access control allow origin -blocked ...
im not sure what exaclty im doing wrong - its my first time using appwrite - and im watching a tutorial about how to create a movie app and followed everything ...
- Number of Database Reads Bugged
My Appwrite project is generating a huge amount of database reads even when all my apps are closed and no one is using it. The reads counter keeps going up. (it...
- [SOLVED] Appwriteexception: invalid redi...
I've been following this documentation on my app: https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-7 On Localhost and local development, it's working fi...
