Qore mongodb Module 2.3.0
Loading...
Searching...
No Matches
Qore mongodb Module

mongodb Module Introduction

The mongodb module provides MongoDB database connectivity for Qore programs, allowing applications to interact with MongoDB servers for document storage, retrieval, and management.

This module wraps the libmongoc C driver library to provide efficient and full-featured MongoDB connectivity including:

  • Connection management with connection pooling
  • CRUD operations (Create, Read, Update, Delete)
  • Aggregation pipelines
  • Cursor-based iteration for large result sets
  • BSON type support including ObjectId

This module is released under the MIT license (see COPYING.MIT in the source distribution for more information). The module is tagged as such in the module's header (meaning it can be loaded unconditionally regardless of how the Qore library was initialized).

To use the module in a Qore script, use the %requires directive as follows:

%requires mongodb
mongodb namespace
Definition QC_MongoClient.dox.h:2

Classes provided by this module:

Connection Strings

MongoDB connections use the standard MongoDB connection string format:

mongodb://[username:password@]host[:port][/database][?options]

Examples:

# Connect to local MongoDB
MongoClient client("mongodb://localhost:27017");
# Connect with authentication
MongoClient client("mongodb://user:password@localhost:27017/mydb?authSource=admin");
# Connect to replica set
MongoClient client("mongodb://host1:27017,host2:27017,host3:27017/?replicaSet=myReplicaSet");

mongodb Module Release Notes

mongodb Module Version 1.0

  • Initial release with full CRUD support
  • Aggregation pipeline support
  • Cursor-based iteration
  • ObjectId type support
  • BSON to Qore type conversion