I have an collection of objects inside the array like this.
example-
const [arrray, setarray] = useState<any[]>([
{
link: "",
title: "",
description: "",
tags: [],
images: null,
status: "pending",
category: "",
ownerId: "",
type: "Website Link",
},
{
link: "",
title: "",
description: "",
tags: [],
images: null,
status: "pending",
category: "",
ownerId: "",
type: "Website Link",
},
])
Is their any way that i can store this in appwrite database as it is. because user can add multiple objects up to 25 objects inside the array. after that what i want to do it is i wanted to show that data in card step by step as it is stored . I hope you understood so how i can implement this in appwrite . Or i have to store every object individually?.please help me with the approach.
Hey you could have an attribute which is a string and push the array as a string
And when you retrieve it from the db you could just parse the string
So while pushing the array , you should convert the array to a string by using json.stringify
and while retrieving you could use json.parse
to convert the string back to an array
Hope this makes sense @LAKSHYA
BTW for your reference appwrite doesn't allow to store objects or arrays as it is
okay this makes sense 🤔. Let me try this approach.
thankyou
Sure, lemme know if it works
sure
Recommended threads
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Attributes Confusion
```import 'package:appwrite/models.dart'; class OrdersModel { String id, email, name, phone, status, user_id, address; int discount, total, created_at; L...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...