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
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Need Help with Google OAuth2 in Expo usi...
I'm learning React Native with Expo and trying to set up Google OAuth2 with Appwrite. I couldn't find any good docs or tutorials for this and my own attempt did...