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
- application/json
Body
query stringrequired
The X-SQL Query string
variables objectrequired
The variables
Responses
- 200
Mutation response
- application/json
- Schema
- Example (from schema)
Schema
data object[]
Array of documents mutated
{
"data": [
{}
]
}
Loading...