Skip to content

Latest commit

 

History

History
267 lines (208 loc) · 13.8 KB

api-index.md

File metadata and controls

267 lines (208 loc) · 13.8 KB

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

Document Description
Native API comparison MongoDB native APIs vs monSQLize extensions
Basic usage Common CRUD, pagination, read cache, and Model entry-point examples
Configuration reference Complete new MonSQLize(options) constructor options
Connection management Connection lifecycle and accessors
Pool configuration Multi-pool configuration and runtime routing: declare pools: PoolConfig[] in the constructor and access pools through pool() / use()
Chain pool/database access Chain pool/database access API: pool() / use() / scopedCollection() / scopedModel()
ObjectId auto conversion ObjectId auto conversion for MongoDB query and write paths
Model layer Model schema validation, methods, hooks, relations, and runtime binding
Populate API Load related documents declared by Model relations
Relations API Define hasOne / hasMany / belongsTo-style relationships, array keys, and default selection
Hooks API Standard Model lifecycle hooks for create, update, delete, and find flows
Relations and Populate Model relationship definitions and related-data population
Nested Populate Multi-level relation population
SSH tunnel SSH tunnel: securely connect to private-network databases
Error code reference Error code reference: complete error-code definitions and handling guide
Cache system Cache system (LRU + TTL)
Transaction management Transaction management (automatic retry, cache locks)
Write path policy Optional runtime policy for Model-only write namespaces
Change Stream sync Change Stream data sync: real-time backup to multiple databases
Transaction optimizations Transaction optimization strategies
Distributed deployment Distributed deployment guide for multi-instance cache consistency
Production rollout Production data task rollout, CDC sync, index preflight, and traffic-switch checks
Production data migration Scenario guide for data, indexes, and field edits from development or staging to production
Data tasks API One DataTaskJob, four methods, parameters, backup, and restore contracts
Event system Event system

Query Operations

Document Method Description
Find documents find() Query multiple documents
Find one document findOne() Query one document
Paginated find findPage() Cursor pagination query
Count documents count() Count documents
Distinct values distinct() Distinct query
Watch changes watch() Watch real-time data changes with Change Streams

Write Operations

Insert Operations

Document Method Description
Insert one document insertOne() Insert one document
Insert many documents insertMany() Insert many documents
Batch insert insertBatch() Large batch insert with batching and retry
Write operations guide All insert methods Complete write operations guide

Update Operations

Document Method Description
Update methods overview All update methods Method choice, traditional operators, and pipeline handoff
Upsert guide Upsert guide Insert when missing, update when present
Update one document updateOne() Update one document
Update many documents updateMany() Update many documents
Aggregation pipeline update guide Aggregation pipeline update Field-to-field calculation, conditional assignment, and pipeline details
Batch update updateBatch() Large batch update with batching and retry
Replace one document replaceOne() Replace a whole document
Find one and update findOneAndUpdate() Atomically update and return
Find one and replace findOneAndReplace() Atomically replace and return

Convenience Methods

Document Method Description
Upsert one document upsertOne() Update if present, insert if missing
Increment one document incrementOne() Atomically increment or decrement field values

Delete Operations

Document Method Description
Delete one document deleteOne() / Model protected delete Delete one document or restrict deletion using declared relations
Delete many documents deleteMany() Delete many documents
Batch delete deleteBatch() Large batch delete with batching and retry
Find one and delete findOneAndDelete() Atomically delete and return

Aggregation Operations

Document Method Description
Aggregation pipeline aggregate() Aggregation pipeline query
Vector search Collection / Model vectorSearch() MongoDB Vector Search query with Model soft-delete visibility when applicable
Search indexes Collection / Model createSearchIndex() and related methods Create, inspect, update, drop, and wait for Search indexes (search and vectorSearch types)
GridFS msq.gridfs() / Model gridfs() Upload, download, and resume GridFS files

Advanced Features

Document Description
Chain query API Chain query API
Chain method reference Detailed chain method reference
Query plan analysis Query plan analysis
Pagination bookmarks Pagination bookmark management

Utilities and Configuration

Document Description
Utility functions Utility functions
Configuration reference Constructor defaults, cache, Redis, Model, sync, pools, logging, and validation
Collection management Collection management
Read preference Read preference settings
Count queue Count queue control for high-concurrency optimization
Write path policy Configure whether writes may use collection APIs or must use Model APIs
Distributed deployment Distributed deployment configuration

Compatibility and Testing

Document Description
MongoDB driver compatibility Detailed MongoDB driver compatibility notes
findOneAnd return values Unified findOneAnd* return-value behavior
ESM support ES Module (import) support

By Feature Category

CRUD Operations

Create

Read

Update

Delete

Advanced Queries

Performance and Cache


Entries, Examples, and Site Pages

Document Description
Documentation index Documentation directory index
Site home Documentation site home
API reference index Current API reference index
Installation Installation and minimal connection validation
Basic usage Common operations after the first connection succeeds
Examples Example index
Common scenarios Connection, cache, Redis, SSH, pool, and Model usage scenarios
Capability index Capability index

Management, Indexes, and Expressions

Document Description
Administration API Administration API
Database operations Database operations
Create one index Create one index
Create indexes in bulk Create indexes in bulk
Drop an index Drop an index
List indexes List indexes
GridFS GridFS buckets, ranges, and resumable upload
Find and count Find and count
Expression functions Expression functions
Quick upsert Quick upsert

Runtime and Deployment

Document Description
Runtime consistency and boundaries Runtime capability boundaries and consistency contracts
Production rollout Index, one-time data, CDC, and production traffic-switch runbook
Production data migration One-time filtered data and index release scenarios
Support matrix Support matrix
Roadmap boundaries Roadmap boundaries
Validation notes Validation notes

ObjectId, Cache, and Troubleshooting

Document Description
ObjectId conversion scope ObjectId conversion scope
ObjectId cross-version notes ObjectId cross-version notes
ObjectId cross-version FAQ ObjectId cross-version FAQ
ObjectId logging optimization ObjectId logging optimization
Cache API Database query cache, multi-layer cache access, invalidation, and statistics
Slow-query logging Slow-query logging
Failure recovery examples Failure recovery examples
Multi-pool health checks Multi-pool health checks
Distributed deployment quick reference Distributed deployment quick reference
Relations quick start Relations 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.