djondb Guide

Inserting documents using DQL

The insert statement allows you to insert documents using the web console or using the driver method executeUpdate.

Basic Structure:


insert [json] into [db]:[namespace]
json json document. Note: JSON document requires the names to be enclosed in quotes.
db database name
namespace namespace where you will store the document.
insert {  
   "name": "John", 
   "lastName": "Doe" 
} into sampledb:customers

djondb will generate a guid id in the field "_id", but You can insert predefined ids inserting the _id into the structure like this:

insert {
   "_id": "1",  
   "name": "John", 
   "lastName": "Doe" 
} into sampledb:customers

The ids are unique, if you try to insert an id that already exists you will get an error

Suggest Edit