Ditto is a NoSQL database that organizes JSON-like documents into collections. Unlike JSON, with Ditto you can apply updates directly to the document, ensuring sync across all connected peers.
id
instead of the reserved _id
parameter. However, if not making API calls, pass the reserved _id
instead.string
or, if forming a composite key, a JSON-object.
upsert
to create a new document, include the id
parameter with a string
set to the value you want to use as the document’s ID.
For example, the following snippet demonstrates creating a new document in the people
collection with the custom ID set to abc123
, along with the specified name
and age
values:
upsert
to create a new document, pass the fields you want to combine to form the new primary key in an embedded map
structure under the id
field.
For example, the following snippet shows an upsert
operation on the people
collection forming a composite key made up of two parts:
string
integer
{a: "foo", b: 1} == { b: 1, a: "foo" }