Add Data to a Collection
Adding Data as a Document to a Collection in WorqDB.
There are three ways to add data to a WorqDB Collection:
- Set the Data of a Document within a Collection, with an automatically generated document identifier or
docId
. - Add a Document with a custom
docId
to identify your document within a Collection. - Create an empty document with an automatically generated identifier, and assign data to it later. You can do this by using the
create
method and then theupdate
method later on.
Javascript
and Typescript
package.Before you begin
See Get started with Create Collections to create a Collection before you add data to it.
Initialize Database Modules
Set the Data of a Document within a Collection
You can add data to a Collection by using the add
method. This method will create a new document with an automatically generated document identifier or docId
.
Add a Document with a custom docId
You can add data to a Collection by using the add
method. This method will create a new document with a custom docId
that you can use to identify your document within a Collection.
Create an empty document with an automatically generated identifier, and assign data to it later
You can create an empty document with an automatically generated identifier, and assign data to it later by using the update
method. This method will create a new document with an automatically generated document identifier or docId
and the Document Creation Timestamp.
You can then update the data within the document later on to add data to it.
Was this page helpful?