Core types
Document
Base interface for all documents stored in the database.Unique identifier for the document (auto-generated on insert)
Additional fields with any values
Configuration types
DatabaseOptions
Configuration options for opening a database.Size of the page cache in bytes. Larger cache improves read performance.
Number of pages written before automatic checkpoint triggers.
Unix file permissions for the database file (e.g.,
0o644).Open database in read-only mode if
true.Maximum number of operations allowed in a single bulk write.
Maximum size of a single document in bytes.
Maximum request body size for web server (if enabled).
TransactionConfig
Configuration for transaction retry behavior.Maximum number of retry attempts for conflicted transactions.
Base delay in milliseconds for exponential backoff.
Maximum delay in milliseconds between retries.
Result types
UpsertResult
Result of an upsert operation.The document ID
true if document was inserted, false if it was updatedBulkWriteResult
Result of a bulk write operation.Number of documents inserted
Number of documents updated
Number of documents deleted
Array of IDs for inserted documents
Array of errors encountered
BulkWriteError
Error information from bulk write operations.Index of the operation that failed
Error message
SearchResult
Result from full-text search operations.Document ID of the matching document
Relevance score (higher is more relevant)
GarbageCollectResult
Result of garbage collection operation.Number of pages reclaimed
Bytes of storage reclaimed
Information types
DatabaseInfo
Comprehensive database information.Database file path
Database schema version
Total number of pages in the database
Database file size in bytes
Array of collection information
Total number of documents across all collections
Whether database is in read-only mode
CollectionInfo
Information about a collection.Collection name
Number of documents in the collection
Root page number of the B-tree index
Array of index information
IndexInfo
Information about an index.Index name
Array of field names in the index
Whether the index enforces uniqueness
Type of index:
'btree' for B-tree index, 'text' for full-text searchBackupInfo
Information about a backup file.Backup file path
Database version
Array of collection names in the backup
Total number of documents in the backup
MetricsSnapshot
Database operation metrics.Total number of document write operations
Total number of document read operations
Total number of all document operations
Number of I/O errors encountered
Number of transaction conflicts
Operation types
BulkOperation
Union type for bulk write operations.BulkInsertOp
Bulk insert operation.Operation type
Document to insert
BulkUpdateOneOp
Bulk update single document operation.Operation type
JMESPath filter to match document
Fields to update
BulkUpdateManyOp
Bulk update multiple documents operation.Operation type
JMESPath filter to match documents
Fields to update
BulkDeleteOneOp
Bulk delete single document operation.Operation type
JMESPath filter to match document
BulkDeleteManyOp
Bulk delete multiple documents operation.Operation type
JMESPath filter to match documents
Aggregation types
AggregationStage
Aggregation pipeline stage.JMESPath filter to match documents
Field name to group by
Output field name for count
Sum aggregation:
field to sum, output field name for resultAverage aggregation:
field to average, output field name for resultMinimum aggregation:
field to find min, output field name for resultMaximum aggregation:
field to find max, output field name for resultSort by field:
field to sort by, asc for ascending (default: true)Maximum number of documents to return
Number of documents to skip
Fields to include in output
Fields to exclude from output
Watch types
ChangeOperation
Type of change operation.WatchCallback
Callback function for watching collection changes.Type of operation:
'insert', 'update', or 'delete'Document ID that changed
The document data (null for delete operations)
Class types
The following classes are exported and documented in their respective pages:- Database - Main database class
- Transaction - Transaction management
- Collection - Collection operations
WebServer- Web UI server (stop method only)WatchHandle- Change watcher handle (stop method only)
WebServer
db.startWebUi(). Call stop() to shut down the web server.
WatchHandle
collection.watch(). Call stop() to stop watching for changes.