Amazon DocumentDB
The Shiny.DocumentDb.DocumentDb package provides a document store over Amazon DocumentDB. Because DocumentDB is MongoDB-wire-compatible, this provider is a thin subclass of the MongoDB provider — you get the full MongoDB feature set, minus the capabilities DocumentDB doesn’t implement, plus DocumentDB-appropriate connection defaults.
When to Use
Section titled “When to Use”- Existing Amazon DocumentDB clusters
- You want the MongoDB provider’s behavior against a managed AWS backend
Installation
Section titled “Installation”dotnet add package Shiny.DocumentDb.DocumentDb-
Direct instantiation
using Shiny.DocumentDb.DocumentDb;var store = new DocumentDbDocumentStore(new DocumentDbDocumentStoreOptions{ConnectionString = "mongodb://user:pass@cluster-endpoint:27017/?replicaSet=rs0&readPreference=secondaryPreferred",DatabaseName = "app",CaCertificatePath = "global-bundle.pem" // Amazon RDS CA bundle}); -
Dependency injection
using Shiny.DocumentDb;builder.Services.AddDocumentDbDocumentStore(o =>{o.ConnectionString = "mongodb://user:pass@cluster-endpoint:27017/?replicaSet=rs0";o.DatabaseName = "app";o.CaCertificatePath = "global-bundle.pem";});AddDocumentDbDocumentStoreregistersIDocumentStoreandIDocumentMaintenanceas singletons.
Connection defaults
Section titled “Connection defaults”DocumentDB differs from MongoDB in two connection-level defaults, both handled for you:
- TLS is on by default. Provide the Amazon RDS CA bundle via
CaCertificatePath(or a preloadedCaCertificatescollection). SetUseTls = falseonly for a local MongoDB proxy in tests. retryWrites = falseby default. DocumentDB does not support retryable writes; the MongoDB driver’s default (true) would break writes.
Capability differences vs. MongoDB
Section titled “Capability differences vs. MongoDB”Everything from the MongoDB provider is inherited — CRUD, LINQ push-down, ordering/paging/projection, spatial (2dsphere), temporal history, backup, maintenance, optimistic-concurrency CAS, and the compensating unit of work — except:
| Feature | MongoDB | Amazon DocumentDB |
|---|---|---|
Full-text ($text) FullTextSearch<T> | yes | throws — DocumentDB has no $text (use Amazon OpenSearch) |
Vector search NearestVectors<T> | yes (Atlas) | throws — Atlas $vectorSearch syntax is unsupported |
SupportsFullText / SupportsVector | true | false |
Ids & concurrency
Section titled “Ids & concurrency”Identical to the MongoDB provider: Guid/string Ids auto-generate; Int/Long Id auto-generation is unsupported; MapVersionProperty<T> provides optimistic concurrency (ConcurrencyException on conflict) folded into an atomic filtered update.
Limitations
Section titled “Limitations”- No
$textfull-text and no vector search (see the table above). - Some MongoDB aggregation/
$exproperators vary by DocumentDB engine version — a heavily computedWheremay need to be simplified. - Everything else follows the MongoDB provider — see its page for query, storage, and unit-of-work details.