Azure Cosmos DB

Azure Cosmos DB is a globally distributed database service designed to enable you to elastically and independently scale throughput and storage across any number of geographical regions with comprehensive SLAs. You can develop document, key/value, or graph databases with Cosmos DB using a series of popular APIs and programming models.

SQL API:
With the SQL API, Azure Cosmos DB provides rich and familiar SQL query capabilities with consistent low latencies over schema-less JSON data. In this article, we provide an overview of the Azure Cosmos DB’s SQL API, and how to best use the API.

Gremlin API:
Azure Cosmos DB provides the Gremlin API for graph modeling and traversal, along with turn-key global distribution, elastic scaling of storage and throughput, and low latency.

Cassandra API
Azure Cosmos DB supports the Cassandra API. This means that by using existing drivers, your application written for Cassandra can now communicate with Azure Cosmos DB instead of Apache Cassandra/Datastax Enterprise databases, and gain benefits like global distribution and elastic scale.

MongoDB API:
Azure Cosmos DB supports the MongoDB API. This means that by using existing drivers, your application written for MongoDB can now communicate with Cosmos DB instead of MongoDB databases, and gain benefits like global distribution & elastic scale.

Table API:
Azure Cosmos DB provides the Table API for key-value workloads. This provides a premium experience for Azure Table storage with secondary indexes, global distribution, low latency, and dedicated throughput.

How can we improve Azure Cosmos DB?

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. Azure CosmosDB is too expensive for small but multiple collections

    Currently using on-prem MongoDB (on Linux) and wish to move to Azure, but I find CosmosDB is too expensive for small but multiple (MongoDB)collections because it seems that a minimum of 400 RRU's/per second will be charged for each collection.

    The terminology used on the pricing web pages is somewhat unclear though and I am not sure if the pricing for the minimum of 400 RRU's/second applies to partitions or collection (or if these terms are in fact identical semantically)

    1,266 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      64 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
    • 586 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        19 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
      • ^ (StartsWith) operator doesn't work using $in operator

        In mongo you can use javascript patterns for regex queries using $in operator, sth like: find({categories: {$in: [/^shoes/,/^boots/]}}), but it seems that operator ^ isn't working in cosmsoDB

        126 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
        • Add Change Feed support to MongoDB API

          Presently leveraging Azure Functions via Cosmos Change Feed is not an option if you use the MongoDB API. Any immediate plans to implement this?

          106 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            1 comment  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
          • Resolve the defect with $elemMatch used in conjunction with $OR in MongoDB API

            Currently, MongoDB API incorrectly evaluates '$OR' when used in conjunction with '$elemMatch'. e.g. take 2 records like this:

            /* 1 */
            {
            "_id" : ObjectId("5b4f8fc167bd4749b84cebac"),
            "name" : "Ron Swanson",
            "gender" : "M"
            }

            /* 2 */
            {
            "_id" : ObjectId("5b4f8fea67bd4749b84cebae"),
            "name" : "Hunter S. Thompson",
            "gender" : "M",
            "Likes" : [
            {
            "roadtrips" : "yes"
            },
            {
            "applepie" : "yes"
            },
            {
            "politicians" : "no"
            }
            ]
            }

            and run this query:

            db.myCollection.find(
            {
            "$or": [
            {"gender":"M"},
            {"Likes": {"$elemMatch": {"applepie": "yes"}}}

            ]

            }
            )

            the cosmosDB with MongoAPI will only return the second one, effectively treating what should be an…

            93 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
            • Better handling of "request limit too large"

              Here (https://docs.microsoft.com/en-us/azure/cosmos-db/performance-tips) you can see that when you have exceeded your RU/s quota, Cosmos DB will respond with HTTP Status 429 with an HTTP header x-ms-retry-after-ms telling you when you can make the next request. It also says that the request will be retried automatically, if you use the SQL API.

              For the MongoDB API, requests will not be retried automatically and there is nothing telling the user how long to wait before retrying. Instead you have to catch a MongoCommandException, look at the Code property for 16500 and guess when to retry,

              I'd like the same support…

              77 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
              • Add support for "Search text" ($text Operator)

                Support for "Mongo Search Text" (https://docs.mongodb.com/manual/text-search/). Example of use:

                db.stores.find( { $text: { $search: "java coffee shop" } } )

                53 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  need-feedback  ·  10 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                • Needs documentation about limits when MongoDb API is used

                  Seems that information about limitations with MongoDb API is missing,
                  or impossible to find. For example mongo has max doc size 16Mb but
                  Azure docDb 2Mb, which is correct for CosmosDbWithMongoAPI.
                  (Even that documentDb limits documentation which is referred in this site seems to be removed)

                  -Maximum document size ?
                  -Maximum query payload size ?
                  -Maximum query result size ?
                  -Maximum size of partition of partitioned collection ?
                  -Maximum count of documents in the partition of partitioned collection ?
                  -Maximum count of documents in single-partition collection ?
                  -MongoDb needs manual creation of indexes, docDb indexes automatically all properties, how about…

                  47 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                  • support COUNT of a query on a partitioned collection

                    db.collection.count() works just find but when attempting to count a filtered down collection db.collection.find({query...}).count() results in an Operation Failure that says 'query in command must target a single shard key' but need to be able to do counts across multiple partitions

                    47 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      11 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                    • Support for document validation, using JSON Schema

                      Similar to MongoDB v3.6 https://docs.mongodb.com/manual/reference/operator/query/jsonSchema/ Would be useful for both MongoDB API and DocumentDB API

                      41 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        1 comment  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                      • Compound indexes

                        Compound indexes are required for efficiently sorting on multiple fields. See https://docs.mongodb.com/manual/tutorial/sort-results-with-indexes/.

                        36 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                        • Support $GraphLookup

                          $graphLookup is not implemented in Mongo API
                          If you try to do this with Mongo API (or Cosmos DB) + Gremlin you need to know what the relationships are upfront. Need DYNAMIC joins 
                          which MongoDB supports today.

                          31 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                          • Support for transactions via Mongo 4.0 API

                            Mongo 4.0 incl transactions has been released: https://www.mongodb.com/transactions.
                            CosmosDB should support Mongo 4.0 API (including transactions)

                            31 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              1 comment  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                            • MongoDB API : aggregation operation is too slow

                              the aggregation operation is too slow ...

                              29 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                5 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                              • 22 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  2 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                                • CosmosDB, Mongo API, Delete Many with Partition Key configured

                                  We have an IoT based solution and archive old data to blob storage. Our data is moved to archive using the shard key. Removing the data once archived is a pain and slow as each individual document has to be deleted rather than using DeleteMany(x=>x.shardId == id).

                                  More info found at:
                                  https://stackoverflow.com/questions/51301711/cosmosdb-mongo-api-delete-many-with-partition-key-configured

                                  18 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                    0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Support TTL indexes on any field

                                    Please add support for TTL indexes on any field, not just the internal and inaccessible `_ts` field. We need document specific TTLs.

                                    https://docs.mongodb.com/manual/tutorial/expire-data/

                                    18 votes
                                    Vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      Signed in as (Sign out)
                                      You have left! (?) (thinking…)
                                      0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Support native Aggregate pipeline feature: ReplaceRoot

                                      Currently CosmosDb Mongo API does not support ReplaceRoot in Aggregate pipeline features. This feature is very-powerful while working with grouping and need to extract properties for Entity mapping in C#, .As<TEntity>().

                                      var latestVersions = BsonCollection.Aggregate()
                                      .Sort(Builders<BsonDocument>.Sort.Descending(nameof(BaseEntity.Revision)))
                                      .Group(new BsonDocument
                                      {
                                      {"_id", new BsonDocument("UniqueIdentifier", "$UniqueIdentifier")},
                                      {"LatestVersion", new BsonDocument("$first", "$$ROOT")}
                                      };)
                                      .ReplaceRoot(g => g["LatestVersion"]) //Azure Cosmos Db Does not support this.
                                      .As<TEntity>()
                                      .Match(filterExpression)
                                      .Match(e => includeDeleted || e.IsDeleted == false)
                                      .Sort(sortDefinition);

                                      16 votes
                                      Vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        Signed in as (Sign out)
                                        You have left! (?) (thinking…)
                                        3 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Support MongoDB's $where operation

                                        MongoDB's '$where' operation (https://docs.mongodb.com/manual/reference/operator/query/where/) seems to be unsupported. It returns:
                                        {
                                        "_t" : "OKMongoResponse",
                                        "ok" : 0,
                                        "code" : 2,
                                        "errmsg" : "Request is malformed",
                                        "$err" : "Request is malformed"
                                        }
                                        This limits the usability of Cosmos as a drop-in replacement for MongoDB when these queries are needed. Providing $expr (https://docs.mongodb.com/manual/reference/operator/query/expr/#op._S_expr) may be a useful workaround.

                                        10 votes
                                        Vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          Signed in as (Sign out)
                                          You have left! (?) (thinking…)
                                          0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Support MongoDB's $expr operation

                                          MongoDB's '$expr' operation (https://docs.mongodb.com/manual/reference/operator/query/expr/#op._S_expr) seems to be unsupported. When including '$expr' in a query it seems to be treated as a regular field name.
                                          This limits the usability of Cosmos as a drop-in replacement for MongoDB when these queries are needed.

                                          10 votes
                                          Vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            Signed in as (Sign out)
                                            You have left! (?) (thinking…)
                                            0 comments  ·  MongoDB API  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3
                                          • Don't see your idea?

                                          Azure Cosmos DB

                                          Feedback and Knowledge Base