Creating documents
Insert a single document
Insert a document into a collection. If no_id is provided, one will be auto-generated.
Rust
Go
Python
If your document includes an
_id field and that ID already exists, the insert will fail. Use upsert to insert or update.Insert multiple documents
Insert many documents in a single transaction for better performance.Typed document insertion
Use Rust’s type system for compile-time safety:Reading documents
Find by ID
Retrieve a single document by its unique identifier.Find all documents
Retrieve every document in a collection.Find with query
Filter documents using jasonisnthappy’s query language.Find one document
Get the first document matching a query.Count documents
Updating documents
Update by ID
Update fields on a specific document. Existing fields are merged.Update with query
Update all documents matching a query.Update one document
Update only the first match.Upsert operations
Insert a document if it doesn’t exist, otherwise update it.Deleting documents
Delete by ID
Remove a specific document.Delete with query
Remove all documents matching a query.Delete one document
Remove only the first match.Bulk operations
Perform multiple mixed operations in a single transaction.- Ordered execution
- Unordered execution
Distinct values
Get unique values for a field across all documents.Performance tips
Next steps
Querying
Learn the query language syntax
Indexes
Speed up queries with indexes
Schema validation
Enforce document structure
Aggregation
Analyze data with pipelines