You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`DocumentDB` is a MongoDB compatible open source document database built on PostgreSQL. It offers a native implementation of a document-oriented NoSQL database, enabling seamless CRUD (Create, Read, Update, Delete) operations on BSON(Binary JSON) data types within a PostgreSQL framework. Beyond basic operations, DocumentDB empowers users to execute complex workloads, including full-text searches, geospatial queries, and vector search, delivering robust functionality and flexibility for diverse data management needs.
3
+
`ivydocumentdb` is an open-source project developed based on Microsoft DocumentDB and compatible with IvorySQL. It offers a native implementation of document-oriented NoSQL database, enabling seamless CRUD (Create, Read, Update, Delete) operations on BSON(Binary JSON) data types within an IvorySQL framework. Beyond basic operations, ivydocumentdb empowers you to execute complex workloads, including full-text searches, geospatial queries, and vector embeddings on your dataset, delivering robust functionality and flexibility for diverse data management needs.
4
+
5
+
[IvorySQL](https://docs.ivorysql.org/en/ivorysql-doc) is advanced, fully featured, open source Oracle compatible PostgreSQL with a firm commitment to always remain 100% compatible and a Drop-in replacement of the latest PostgreSQL.
4
6
5
7
[PostgreSQL](https://www.postgresql.org/about/) is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.
6
8
9
+
[DocumentDB](https://github.com/documentdb/documentdb) is the engine powering vCore-based Azure Cosmos DB for MongoDB.
10
+
7
11
## Components
8
12
9
-
The project comprises of three components, which work together to support document operations.
13
+
The project comprises of two primary components, which work together to support document operations.
10
14
11
15
-**pg_documentdb_core :** PostgreSQL extension introducing BSON datatype support and operations for native Postgres.
12
16
-**pg_documentdb :** The public API surface for DocumentDB providing CRUD functionality on documents in the store.
13
-
-**pg_documentdb_gw :** The gateway protocol translation layer that converts the user's MongoDB APIs into PostgreSQL queries.
14
17
15
18
16
19
## Why DocumentDB ?
@@ -31,140 +34,238 @@ We chose PostgreSQL as our platform for several reasons:
31
34
32
35
## Get Started
33
36
34
-
### Prerequisites
35
-
- Python 3.7+
36
-
- pip package manager
37
-
- Docker
38
-
- Git (for cloning the repository)
37
+
### Pre-requisite
38
+
39
+
- Ensure [Docker](https://docs.docker.com/engine/install/) is installed on your system.
> **Note:** During the transition to the Linux Foundation, Docker images may still be hosted on Microsoft's container registry. These will be migrated to the new DocumentDB organization as the transition completes.
73
-
> **Note:** Replace `<YOUR_USERNAME>` and `<YOUR_PASSWORD>` with your desired credentials. You must set these when creating the container for authentication to work.
74
-
>
75
-
> **Port Note:** Port `10260` is used by default in these instructions to avoid conflicts with other local database services. You can use port `27017` (the standard MongoDB port) or any other available port if you prefer. If you do, be sure to update the port number in both your `docker run` command and your connection string accordingly.
103
+
#### External Access
104
+
Connect to `psql` shell
76
105
77
-
Step 4: Initialize the pymongo client with the credentials from the previous step
DocumentDB provides [documentdb_api.create_collection](https://github.com/microsoft/documentdb/wiki/Functions#create_collection) function to create a new collection within a specified database, enabling you to manage and organize your BSON documents effectively.
The [documentdb_api.insert_one](https://github.com/microsoft/documentdb/wiki/Functions#insert_one) command is used to add a single document into a collection.
DocumentDB uses the [documentdb_api.update](https://github.com/microsoft/documentdb/wiki/Functions#update) function to modify existing documents within a collection.
DocumentDB uses the [documentdb_api.delete](https://github.com/microsoft/documentdb/wiki/Functions#delete) function for precise document removal based on specified criteria.
178
+
179
+
The SQL command deletes the document for patient `P002`.
We can review for the available collections and databases by querying [documentdb_api.list_collections_cursor_first_page](https://github.com/microsoft/documentdb/wiki/Functions#list_collections_cursor_first_page).
[documentdb_api.list_indexes_cursor_first_page](https://github.com/microsoft/documentdb/wiki/Functions#list_indexes_cursor_first_page) allows reviewing for the existing indexes on a collection. We can find collection_id from `documentdb_api.list_collections_cursor_first_page`.
- Check out our [website](https://documentdb.io) to stay up to date with the latest on the project.
168
-
- Check out our [docs](https://documentdb.io/docs) for MongoDB API compatibility, quickstarts and more.
169
-
- Contributors and users can join the [DocumentDB Discord channel](https://discord.gg/vH7bYu524D) for quick collaboration.
170
-
- Check out [FerretDB](https://github.com/FerretDB/FerretDB) and their integration of DocumentDB as a backend engine.
199
+
`ttl` indexes by default gets scheduled through the `pg_cron` scheduler, which could be reviewed by querying the `cron.job` table.
200
+
201
+
```sql
202
+
select*fromcron.job;
203
+
```
204
+
205
+
### Indexing
206
+
207
+
#### Create an Index
208
+
209
+
DocumentDB uses the `documentdb_api.create_indexes_background` function, which allows background index creation without disrupting database operations.
210
+
211
+
The SQL command demonstrates how to create a `single field` index on `age` on the `patient` collection of the `documentdb`.
DocumentDB uses the `documentdb_api.drop_indexes` function, which allows you to remove an existing index from a collection. The SQL command demonstrates how to drop the index named `id_ab_1` from the `first_collection` collection of the `documentdb`.
DocumentDB provides the [documentdb_api.aggregate_cursor_first_page](https://github.com/microsoft/documentdb/wiki/Functions#aggregate_cursor_first_page) function, for performing aggregations over the document store.
234
+
235
+
The example projects an aggregation on number of patients registered over the years.
This query performs an aggregation on the `patient` collection to group documents by `registration_year`. It collects unique patient conditions for each registration year using the `$addToSet` operator.
0 commit comments