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
- I'm getting error Invalid `url` param: I...
``` 2025-10-26T12:52:02.292Z [error] AppwriteException: Invalid `url` param: Invalid URI. Register your new client (vercel.com) as a new Web platform on your pr...
- 🚨 Access Restricted Despite Active Cred...
Hello Appwrite Support Team, My organization “Dreamo World Entertainment” currently shows an “Access Restricted” warning due to unpaid invoices. However, my bi...
- Deploy tanstack-start on site
- I am trying to deploy my project build with tanstack-start on site. - issue i am facing is appwrite doesnt provide start command option so i can run 'npm run ...