Skip to content
Back

Actually, when creating a collection what options do I have.

  • 0
  • Databases
kriihz77
9 Feb, 2024, 22:02

I was doing a search in bard, but something is not clear to me, one of the answers highlights that with appwrite you can create a collection of several types

select a collection type between "Documents", "JSON" and "Files".

But the question is can I really save json inside an appwrite collection or is it because bard is wrong.

TL;DR
Developers are wondering if they need to define attributes when creating a collection or if they can just insert data without specifying attributes. It is recommended to refer to the documentation for the most accurate information. Collections in Appwrite do not support JSON directly, so if you want to save a JSON object in a collection, you would need to stringify it first and parse it when fetching. Bard may not have provided clear information on this, so it's best to consult the documentation for collection types in Appwrite. The available collection types are "Documents," "JSON," and "Files."
Kenny
9 Feb, 2024, 22:07

Not sure what collection types are, but collections do not support JSONs, so if you want to save a JSON in an attribute on a collection you would have to stringify it first then parse it when fetching.

Kenny
9 Feb, 2024, 22:08

Though bard is neat, I think your best bet for this type of information is just looking directly at the documentation.

https://appwrite.io/docs/references/cloud/server-nodejs/databases

Guille
9 Feb, 2024, 22:35

When ask information to bard or chatgpt make sure to request information of the latest version, you can pass it the page of the feature you are asking so the information will be more accurate

kriihz77
9 Feb, 2024, 22:45

document = { "name": "Mi documento", "description": "Este es mi primer documento en Appwrite", "data": { "key1": "value1", "key2": "value2" } }

response = client.databases.create_document( database_id="YOUR_DATABASE_ID", collection_id="YOUR_COLLECTION_ID", document=document )

Based on this example, I have to create the attributes for the collection or just insert the data without defining the attributes.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more