eneszh
v1v2
InceptionDB
Lambda
Files
Config
InstantLogs
Tailon

Working with Data

This document explains how to insert, list, modify, and delete documents in a collection. It also includes how to filter data when listing.

Inserting Documents

Insert a Single Document

To insert a single document into a collection, use the following HTTP request:

 1POST /databases/{database}/collections/{collection}/documents
 2Content-Type: application/json
 3X-API-Key: your-api-key
 4
 5{
 6  "document": {
 7    "key1": "value1",
 8    "key2": "value2"
 9  }
10}

Insert Multiple Documents

To insert multiple documents into a collection, use the following HTTP request:

 1POST /databases/{database}/collections/{collection}/documents/bulk
 2Content-Type: application/json
 3X-API-Key: your-api-key
 4
 5{
 6  "documents": [
 7    {
 8      "key1": "value1",
 9      "key2": "value2"
10    },
11    {
12      "key1": "value3",
13      "key2": "value4"
14    }
15  ]
16}

Listing Documents

List All Documents (Full Scan)

To list all documents in a collection, use the following HTTP request:

1GET /databases/{database}/collections/{collection}/documents
2X-API-Key: your-api-key

List Documents by Unique Index

To list documents using a unique index, use the following HTTP request:

1GET /databases/{database}/collections/{collection}/documents?filter={"key":"value"}
2X-API-Key: your-api-key

List Documents with a Limit

To list documents with a specific limit, use the following HTTP request:

1GET /databases/{database}/collections/{collection}/documents?limit=10
2X-API-Key: your-api-key

Modifying Documents

Modify Documents by Full Scan

To modify documents by a full scan, use the following HTTP request:

1PATCH /databases/{database}/collections/{collection}/documents
2Content-Type: application/json
3X-API-Key: your-api-key
4
5{
6  "filter": {"key": "value"},
7  "update": {"$set": {"key": "new_value"}}
8}

Modify Documents by Index

To modify documents using an index, use the following HTTP request:

1PATCH /databases/{database}/collections/{collection}/documents?filter={"key":"value"}
2Content-Type: application/json
3X-API-Key: your-api-key
4
5{
6  "update": {"$set": {"key": "new_value"}}
7}

Deleting Documents

Delete Documents by Index

To delete documents using an index, use the following HTTP request:

1DELETE /databases/{database}/collections/{collection}/documents?filter={"key":"value"}
2X-API-Key: your-api-key

Delete Documents by Full Scan

To delete documents by a full scan, use the following HTTP request:

1DELETE /databases/{database}/collections/{collection}/documents
2Content-Type: application/json
3X-API-Key: your-api-key
4
5{
6  "filter": {"key": "value"}
7}