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
docker run -v $(pwd):/home/documentdb/code -it documentdb /bin/bash
191
-
192
-
cd code
193
-
```
194
-
195
-
(Aligns local location with docker image created, allows de-duplicating cloning repo again within image).<br>
196
-
Note: Validate container is running `docker container ls`
197
-
198
-
Step 4: Build & Deploy the binaries
199
-
200
-
```bash
201
-
make
202
-
```
203
-
204
-
Note: Run in case of an unsuccessful build `git config --global --add safe.directory /home/documentdb/code` within image.
205
-
206
-
```bash
207
-
sudo make install
208
-
```
209
-
210
-
Note: To run backend postgresql tests after installing you can run `make check`.
211
-
212
-
You are all set to work with DocumentDB.
213
-
214
-
### Using the Prebuilt Docker Image
215
-
216
-
You can use a [prebuilt docker image](https://github.com/microsoft/documentdb/pkgs/container/documentdb%2Fdocumentdb-oss/versions?filters%5Bversion_type%5D=tagged) for DocumentDB instead of building it from source. Follow these steps:
217
-
218
-
#### Pull the Prebuilt Image
219
-
220
-
Pull the prebuilt image directly from the Microsoft Container Registry:
Once you have your `DocumentDB` set up running, you can start with creating collections, indexes and perform queries on them.
273
-
274
-
### Create a collection
275
-
276
-
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.
322
-
323
-
The SQL command updates the `age` for patient `P004`.
DocumentDB uses the [documentdb_api.delete](https://github.com/microsoft/documentdb/wiki/Functions#delete) function for precise document removal based on specified criteria.
338
-
339
-
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`.
`ttl` indexes by default gets scheduled through the `pg_cron` scheduler, which could be reviewed by querying the `cron.job` table.
360
-
361
-
```sql
362
-
select*fromcron.job;
363
-
```
364
-
365
-
### Indexing
366
-
367
-
#### Create an Index
368
-
369
-
DocumentDB uses the `documentdb_api.create_indexes_background` function, which allows background index creation without disrupting database operations.
370
-
371
-
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.
394
-
395
-
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