Qore MongoDbDataProvider Module Reference 1.0
Loading...
Searching...
No Matches

Introduction to the MongoDbDataProvider Module

MongoDB Logo

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:

MongoDB Data Provider Factory

The name of the MongoDB data provider factory is mongodb.

MongoDB Data Provider Examples

These examples are with qdp, the command-line interface to the Data Provider API.

API Example: Insert a Document
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/insert' document='{"name": "test", "value": 42}'
API Example: Find Documents
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/find' filter='{"name": "test"}'
API Example: Update Documents
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/update' filter='{"name": "test"}',update='{"$set": {"value": 100}}'
API Example: Delete Documents
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/delete' filter='{"name": "test"}'
API Example: Aggregation Pipeline
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll/aggregate' pipeline='[{"$group": {"_id": "$category", "total": {"$sum": "$value"}}}]'
Record-Based Example: Search Collection
qdp 'mongodb{url=mongodb://localhost:27017}/databases/mydb/collections/mycoll' name=test

Release Notes

MongoDbDataProvider v1.0

  • Initial release of the module