Larger document sizes and $expr support in Azure Cosmos DB API for MongoDB

Shweta Nayak

Sajeetharan Sinnathurai

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:

  1. Go to “Preview Features” area in your Azure subscription.
  2. Under “Type”, select “Microsoft.DocumentDB”.
  3. Click on “Azure Cosmos DB API For MongoDB 16MB Document Support” in the list of available preview features.
  4. Click the “Register” button at the bottom of the page to join the preview-

Image 16mbPreview
Screenshot of Azure portal

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

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Mark Salim 0

    This reminded me of a feature request I submitted 3 years ago (for SQL API):

    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.

Feedback usabilla icon