![]() |
Qore MongoDbDataProvider Module Reference 1.0
|
The MongoDbDataProvider module provides a dataproviderintro "data provider" API for MongoDB servers. It uses the builtin mongodb module which wraps libmongoc for efficient communication and provides full CRUD operations, aggregation pipelines, and bulk operations.
This data provider provides MongoDB API access to:
databases/{database_name}databases/db_name/collections/{collection_name}databases/db_name/collections/coll_name/{insert, find, update, delete}databases/db_name/collections/coll_name/{aggregate}databases/db_name/collections/coll_name/{bulk}The name of the MongoDB data provider factory is mongodb.
These examples are with qdp, the command-line interface to the Data Provider API.
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/insert' document='{"name": "test", "value": 42}'
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/find' filter='{"name": "test"}'
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/update' filter='{"name": "test"}',update='{"$set": {"value": 100}}'
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/delete' filter='{"name": "test"}'
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/aggregate' pipeline='[{"$group": {"_id": "$category", "total": {"$sum": "$value"}}}]'
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll' name=test