API Reference Index

This index documents the current stable MongoDB adapter APIs and shared runtime capabilities. MySQL and PostgreSQL adapter APIs will receive separate entries after runtime support, public types, examples, and verification coverage are available.

Core Concepts

DocumentDescription
Native API comparisonMongoDB native APIs vs monSQLize extensions
Basic usageCommon CRUD, pagination, read cache, and Model entry-point examples
Configuration referenceComplete new MonSQLize(options) constructor options
Connection managementConnection lifecycle and accessors
Pool configurationMulti-pool configuration and runtime routing: declare pools: PoolConfig[] in the constructor and access pools through pool() / use()
Chain pool/database accessChain pool/database access API: pool() / use() / scopedCollection() / scopedModel()
ObjectId auto conversionObjectId auto conversion for MongoDB query and write paths
Model layerModel schema validation, methods, hooks, relations, and runtime binding
Populate APILoad related documents declared by Model relations
Relations APIDefine hasOne / hasMany / belongsTo-style relationships
Hooks APIStandard Model lifecycle hooks for create, update, delete, and find flows
Relations and PopulateModel relationship definitions and related-data population
Nested PopulateMulti-level relation population
SSH tunnelSSH tunnel: securely connect to private-network databases
Error code referenceError code reference: complete error-code definitions and handling guide
Cache systemCache system (LRU + TTL)
Transaction managementTransaction management (automatic retry, cache locks)
Write path policyOptional runtime policy for Model-only write namespaces
Change Stream syncChange Stream data sync: real-time backup to multiple databases
Transaction optimizationsTransaction optimization strategies
Distributed deploymentDistributed deployment guide for multi-instance cache consistency
Production rolloutProduction data task rollout, CDC sync, index preflight, and traffic-switch checks
Production data migrationScenario guide for data, indexes, and field edits from development or staging to production
Data tasks APIOne DataTaskJob, four methods, parameters, backup, and restore contracts
Event systemEvent system

Query Operations

DocumentMethodDescription
Find documentsfind()Query multiple documents
Find one documentfindOne()Query one document
Paginated findfindPage()Cursor pagination query
Count documentscount()Count documents
Distinct valuesdistinct()Distinct query
Watch changeswatch()Watch real-time data changes with Change Streams

Write Operations

Insert Operations

DocumentMethodDescription
Insert one documentinsertOne()Insert one document
Insert many documentsinsertMany()Insert many documents
Batch insertinsertBatch()Large batch insert with batching and retry
Write operations guideAll insert methodsComplete write operations guide

Update Operations

DocumentMethodDescription
Update methods overviewAll update methodsMethod choice, traditional operators, and pipeline handoff
Upsert guideUpsert guideInsert when missing, update when present
Update one documentupdateOne()Update one document
Update many documentsupdateMany()Update many documents
Aggregation pipeline update guideAggregation pipeline updateField-to-field calculation, conditional assignment, and pipeline details
Batch updateupdateBatch()Large batch update with batching and retry
Replace one documentreplaceOne()Replace a whole document
Find one and updatefindOneAndUpdate()Atomically update and return
Find one and replacefindOneAndReplace()Atomically replace and return

Convenience Methods

DocumentMethodDescription
Upsert one documentupsertOne()Update if present, insert if missing
Increment one documentincrementOne()Atomically increment or decrement field values

Delete Operations

DocumentMethodDescription
Delete one documentdeleteOne()Delete one document
Delete many documentsdeleteMany()Delete many documents
Batch deletedeleteBatch()Large batch delete with batching and retry
Find one and deletefindOneAndDelete()Atomically delete and return

Aggregation Operations

DocumentMethodDescription
Aggregation pipelineaggregate()Aggregation pipeline query

Advanced Features

DocumentDescription
Chain query APIChain query API
Chain method referenceDetailed chain method reference
Query plan analysisQuery plan analysis
Pagination bookmarksPagination bookmark management

Utilities and Configuration

DocumentDescription
Utility functionsUtility functions
Configuration referenceConstructor defaults, cache, Redis, Model, sync, pools, logging, and validation
Collection managementCollection management
Read preferenceRead preference settings
Count queueCount queue control for high-concurrency optimization
Write path policyConfigure whether writes may use collection APIs or must use Model APIs
Distributed deploymentDistributed deployment configuration

Compatibility and Testing

DocumentDescription
MongoDB driver compatibilityDetailed MongoDB driver compatibility notes
findOneAnd return valuesUnified findOneAnd* return-value behavior
ESM supportES Module (import) support

By Feature Category

CRUD Operations

Create

Read

Update

Delete

Advanced Queries

Performance and Cache


Entries, Examples, and Site Pages

DocumentDescription
Documentation indexDocumentation directory index
Site homeDocumentation site home
API reference indexCurrent API reference index
InstallationInstallation and minimal connection validation
Basic usageCommon operations after the first connection succeeds
ExamplesExample index
Common scenariosConnection, cache, Redis, SSH, pool, and Model usage scenarios
Capability indexCapability index

Management, Indexes, and Expressions

DocumentDescription
Administration APIAdministration API
Database operationsDatabase operations
Create one indexCreate one index
Create indexes in bulkCreate indexes in bulk
Drop an indexDrop an index
List indexesList indexes
Find and countFind and count
Expression functionsExpression functions
Quick upsertQuick upsert

Runtime and Deployment

DocumentDescription
Runtime consistency and boundariesRuntime capability boundaries and consistency contracts
Production rolloutIndex, one-time data, CDC, and production traffic-switch runbook
Production data migrationOne-time filtered data and index release scenarios
Support matrixSupport matrix
Roadmap boundariesRoadmap boundaries
Validation notesValidation notes

ObjectId, Cache, and Troubleshooting

DocumentDescription
ObjectId conversion scopeObjectId conversion scope
ObjectId cross-version notesObjectId cross-version notes
ObjectId cross-version FAQObjectId cross-version FAQ
ObjectId logging optimizationObjectId logging optimization
Cache APIDatabase query cache, multi-layer cache access, invalidation, and statistics
Slow-query loggingSlow-query logging
Failure recovery examplesFailure recovery examples
Multi-pool health checksMulti-pool health checks
Distributed deployment quick referenceDistributed deployment quick reference
Relations quick startRelations quick start

Start Path

Recommended reading order for new users:

  1. Installation - Install, connect, and run the first query.
  2. Basic usage - Run common CRUD, pagination, cache, and Model entry-point examples.
  3. Configuration reference - Choose constructor options for the service.
  4. Connection management - Learn connection lifecycle and accessors.
  5. Find documents - Learn query details.
  6. Insert one document / Insert many documents - Learn inserts.
  7. Update one document / Update many documents - Learn updates.
  8. Delete one document / Delete many documents - Learn deletes.
  9. Cache system - Understand the cache mechanism.
  10. Transaction management - Learn transaction management.
  11. Distributed deployment - Multi-instance deployment for production.
  12. Production rollout - Index, one-time data, CDC, and traffic-switch checks.
  13. Production data migration - Configuration-driven release from instance A to production.