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
- Free plan Usage
I using a free plan with one organization. I have three projects but on the free plan I should be able to have 2 projects running But in my case only 1 out of ...
- SPA Not working
So I'm using vite/react, which is spa, and it used to work before, but now whenever I go to any route except the root it shows appwrites 404 page, instead of us...
- Get Started - Web is broken
Trying to complete the get started tasks since the "66%" was finally getting to me, and clicked on "web", was met with: ``` Uncaught TypeError: Cannot read prop...