Skip to main content

INSERT

POST 

The INSERT statement is used to insert one or multiple documents into a collection.

INSERT statement syntax

//--- short form
INSERT [$data] IN [collection_name];

//--- long form
INSERT INTO [collection_name] VALUES [$data]

Query Example

// insert one document
{
"query": "INSERT $data IN articles",
"variables": {
"data": {
"title": "Doc 1",
...
}
}
}
// Insert multiple documents
{
"query": "INSERT INTO articles VALUES $data",
"variables": {
"data": [
{
"title": "Doc 1",
...
},
{
"title": "Doc 2",
...
},
{
"title": "Doc 3",
...
}
]
}
}

Request

Body

    query stringrequired

    The X-SQL Query string

    variables objectrequired

    The variables

Responses

Mutation response

Schema
    data object[]

    Array of documents mutated

Loading...