We are excited to announce these recent updates in Azure Cosmos DB API for MongoDB that enable larger document sizes and expressions in your queries.
16MB document support (General Availability)
To keep database operations as efficient as possible, it is best practice to keep documents to a small size. This applies to Azure Cosmos DB API for MongoDB as well as MongoDB. However, in some application use cases, larger documents may be required and beneficial.
We’re happy to announce the public preview of 16MB document support in Azure Cosmos DB API for MongoDB. You can sign up for this preview through the Azure portal:
- Go to “Preview Features” area in your Azure subscription.
- Under “Type”, select “Microsoft.DocumentDB”.
- Click on “Azure Cosmos DB API For MongoDB 16MB Document Support” in the list of available preview features.
- Click the “Register” button at the bottom of the page to join the preview-
Learn more about Azure Cosmos DB limits and quotas.
Support for query expressions with $expr (General Availability)
$expr allows the use of aggregation expressions while querying the Azure Cosmos DB API for MongoDB data.
It follows the syntax below:
{ $expr: { <expression> } }
The arguments can be any valid aggregation expression.
Read about supported operators in Azure Cosmos DB API for MongoDB in this doc
This reminded me of a feature request I submitted 3 years ago (for SQL API): https://feedback.azure.com/d365community/idea/2dd977fc-0d25-ec11-b6e6-000d3a4f0858
Think of a scenario like this: User container with UserId being the partition key. It has EmailAddress and PhoneNumber fields. These fields cannot be globally unique as of today. Cosmos DB only offers uniqueness per logical partition.