Quick Start Guide with InceptionDB
This guide will help you get started with InceptionDB by creating a collection, inserting three elements, and querying filtered elements.
Step 1: Create a Collection
To create a collection in InceptionDB, you need to define the name of the collection. Here is an example of how to do it using curl in bash:
1curl -X POST "https://example.com/v1/databases/your-database-id/collections" \
2-H "Api-Key: your-api-key" \
3-H "Api-Secret: your-api-secret" \
4-d '{
5 "name": "my-collection"
6 }'
Expected Response
1{
2 "defaults": {
3 "id": "uuid()"
4 },
5 "indexes": 0,
6 "name": "my-collection",
7 "total": 0
8}
Step 2: Insert Elements
Once you have created the collection, you can insert elements into it. Here is how to insert three elements into the newly created collection:
1curl -X POST "https://example.com/v1/databases/your-database-id/collections/my-collection/documents" \
2-H "Api-Key: your-api-key" \
3-H "Api-Secret: your-api-secret" \
4-d '{
5 "name": "Element 1",
6 "value": 100
7 }
8 {
9 "name": "Element 2",
10 "value": 200
11 }
12 {
13 "name": "Element 3",
14 "value": 300
15 }'
Step 3: List Filtered Elements
To list elements in the collection with a specific filter, you can use the following curl request:
1curl -X POST "https://example.com/v1/databases/your-database-id/collections/my-collection/find" \
2-H "Api-Key: your-api-key" \
3-H "Api-Secret: your-api-secret" \
4-d '{
5 "filter": {
6 "value": { "$gte": 200 }
7 }
8 }'
Expected Response
1{
2 "documents": [
3 {
4 "id": "document-id-2",
5 "name": "Element 2",
6 "value": 200
7 },
8 {
9 "id": "document-id-3",
10 "name": "Element 3",
11 "value": 300
12 }
13 ]
14}
Summary
By following these steps, you have created a collection in InceptionDB, inserted three elements, and queried elements with a filter. This provides you with a solid foundation to start working with InceptionDB and take advantage of its capabilities to efficiently manage your data.