Skip to content

Commit 25e8799

Browse files
authored
docs: add few notes about DocumentDB and Azure Cosmos DB (#11336)
Adds few notes about limitations when using Azure Cosmos DB and DocumentDB Discussion: #11333
1 parent 6cbda9e commit 25e8799

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/database/mongodb.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,11 @@ You can access Mongoose models as follows:
5050
- Collection models - `payload.db.collections[myCollectionSlug]`
5151
- Globals model - `payload.db.globals`
5252
- Versions model (both collections and globals) - `payload.db.versions[myEntitySlug]`
53+
54+
## Using other MongoDB implementations
55+
Limitations with [DocumentDB](https://aws.amazon.com/documentdb/) and [Azure Cosmos DB](https://azure.microsoft.com/en-us/products/cosmos-db):
56+
57+
* For Azure Cosmos DB you must pass `transactionOptions: false` to the adapter options. Azure Cosmos DB does not support transactions that update two and more documents in different collections, which is a common case when using Payload (via hooks).
58+
* For Azure Cosmos DB the root config property `indexSortableFields` must be set to `true`.
59+
* The [Join Field](../fields/join) is not supported in DocumentDB and Azure Cosmos DB, as we internally use MongoDB aggregations to query data for that field, which are limited there. This can be changed in the future.
60+
* For DocumentDB pass `disableIndexHints: true` to disable hinting to the DB to use `id` as index which can cause problems with DocumentDB.

docs/fields/join.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ of relationship types in an easy manner.
6262
The Join field is extremely performant and does not add additional query overhead to your API responses until you add depth of 1 or above. It works in all database adapters. In MongoDB, we use **aggregations** to automatically join in related documents, and in relational databases, we use joins.
6363
</Banner>
6464

65+
<Banner type="warning">
66+
The Join Field is not supported in [DocumentDB](https://aws.amazon.com/documentdb/) and [Azure Cosmos DB](https://azure.microsoft.com/en-us/products/cosmos-db), as we internally use MongoDB aggregations to query data for that field, which are limited there. This can be changed in the future.
67+
</Banner>
68+
6569
### Schema advice
6670

6771
When modeling your database, you might come across many places where you'd like to feature bi-directional relationships.

0 commit comments

Comments
 (0)