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. Support cross-document joins

    I have a many-to-many scenario that requires something like document-to-document joins.

    In my app, users can "like" posts. That's three "tables" or entity sets. One each for users, likes and posts. I can't put the likes inside of either the users or the posts entities as sub-documents because there could be thousands of them. Even with 256KB documents I'd run out of room pretty quickly. I need a way to quickly get the top 100 posts that a user liked (and continue to paginate from there). I also need to go the other way. I need to get all the…

    1,282 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      24 comments  ·  Flag idea as inappropriate…  ·  Admin →

      For applications that require cross document join, please consider the Gremlin API: https://docs.microsoft.com/en-us/azure/cosmos-db/create-graph-dotnet, which has primitives for joins, traversals, and other graph operations.

      We are evaluating expanding the SQL grammar to support graph functionality, which will provide the ability to perform cross-document JOINs. Please upvote this item to help us prioritize this work.

    • Transaction support in client SDKs

      it would be useful if documentdb transactions are supported in .net, rather than just storedprocs and triggers.
      using trans = newtrans()
      try
      db.addsomething()
      db.save() //ok
      db.addother()
      db.save() //fail
      catch
      trans.rollback
      end try
      end using

      1,109 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        18 comments  ·  Flag idea as inappropriate…  ·  Admin →
      • Set based operations (INSERT, UPDATE, DELETE)

        It would be nice to be able to update parts of documents, delete documents, and insert documents using set based operations, similar to SQL.

        e.g.
        UPDATE Users SET IsActive = 0 WHERE LastLogin < '2010-01-01'
        DELETE FROM Users WHERE LastLogin < '2009-01-01'
        INSERT INTO table2 SELECT * FROM table1

        818 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          7 comments  ·  Flag idea as inappropriate…  ·  Admin →

          There are multiple responses to this suggestion.

          Support for SQL-like syntax for UPDATE, DELETE and INSERT INTO are not on our road map at this time.

          However, the underlying functionality for an UPDATE, SET is essentially a PATCH. This functionality we are actively working on. See this User Voice item here to track for future updates. https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/6693091-be-able-to-do-partial-updates-on-document

          Thank you for your suggestion.

        • Support Document Versioning

          The ability to generate links to a previous version of a document would be a powerful addition DocumentDB that has many use cases.

          In my case I need a self managed profile document that needs to be referenced at point in time to be tied to an event.

          695 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            8 comments  ·  Flag idea as inappropriate…  ·  Admin →

            Azure Cosmos DB now provides the ability to access the change feed (https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed). A common pattern to implement eventing patterns is

            1. Store every version/change as a separate item
            2. Read the change feed to merge/consolidate changes and trigger appropriate actions downstream.

            You can also expire old versions using TTL: https://docs.microsoft.com/en-us/azure/cosmos-db/time-to-live

          • Add support for single entity retrieval instead of IEnumarable

            Single \ First and so are currently not supported in Document DB

            For example, the following code:

            return _client.CreateDocumentQuery<TEntity>(_collection.SelfLink).SingleOrDefault(x => x.Id == id);

            causes the error:

            An exception of type 'Microsoft.Azure.Documents.Linq.DocumentQueryException' occurred in Microsoft.Azure.Documents.Client.dll but was not handled in user code

            Additional information: Query expression is invalid, expression return type Entities.Models.Hierarchy is unsupported. Query must evaluate to IEnumerable.

            464 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              4 comments  ·  Flag idea as inappropriate…  ·  Admin →

              Thank you for your feedback. I have discussed this in more detail with our team.

              You are correct the workaround suggested to use .AsEnumerable().FirstOrDefault(). should not be a recommended work around. This way results in materializing all documents on the client first before getting the 1st document, which is not very efficient and the exact opposite of what you are trying to achieve.

              Instead we recommend you use Take(1).AsEnumerable() and then .First() or .Single() or .FirstOrDefault() for Single() and First(). Take(1) is translated to SELECT TOP 1 and is processed server-side so more efficient than the previous suggestion and is what you are trying to achieve.

              As to the original ask. The support for these operations can be done, but this work is not prioritized against the other work we want to deliver. I will move this back as unplanned but please note this is on our roadmap.

              Thanks again…

            • Support Cypher as a query language for Graph data

              Add Cyhper (see http://www.opencypher.org/) as a language to query graph databases. Cypher is a human readable query languages to easily access a graph database.

              401 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                10 comments  ·  Gremlin API  ·  Flag idea as inappropriate…  ·  Admin →
              • Add ability to rename databases and collections

                It should be possible to rename databases and collections.

                This feature is universal in all if not the vast majority of database products.

                Lack of ability to rename anything makes it very hard for us to manage releases if we are adding new data. Currently, we have to create a copy of the existing database (which is a feat in itself, since this again is not core functionality), make the change there, and then re-point the website to the updated database. All this time, we are incurring extra costs and inconvenience.

                Renaming things also allows us to correct typos, which…

                296 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  ·  Flag idea as inappropriate…  ·  Admin →

                  The ability to rename databases and collections is not currently something that is in our road map.

                  Currently the way to accomplish this task in Cosmos DB is to create a new collection with the changed name then use bulk exec or change feed to populate it.

                  Thanks for your request and input on this. We may consider this for a future planning cycle.

                  thanks.

                • Support ORDER BY on the ST_DISTANCE spatial function

                  Ordering results by the ST_DISTANCE spatial function is currently not supported.

                  280 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    13 comments  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                  • Linq provider should respect JsonSerializerSettings ContractResolvers

                    JsonSerializerSettings are now supported when creating the client, as per https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/6422364-allow-me-to-set-jsonserializersettings

                    However, when using for example a CamelCasePropertyNamesContractResolver to store the data, the linq queries will fail if the properties on the POCO classes are Pascal case.

                    250 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      8 comments  ·  Flag idea as inappropriate…  ·  Admin →
                    • Implement a graphql provider

                      graphql {http://graphql.org/} is becoming increasingly adopted by front end frameworks (including mobile) for querying backend / API data.

                      Rather than having to translate each graphql query into a DocumentDB client call it would be optimal and very powerful to issue the query directly.

                      It would also provide enhanced query abilities over the existing REST approach.

                      253 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  ·  Gremlin API  ·  Flag idea as inappropriate…  ·  Admin →
                      • Support the CouchDB replication protocol

                        Support the CouchDB replication protocol so that we can sync with PouchDB or Couchbase Lite NoSQL databases on mobile devices for superior online / offline capabilities.

                        211 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  ·  Flag idea as inappropriate…  ·  Admin →
                        • Open source DocumentDB

                          Why in the world isn't DocumentDB available as open source? Didn't you guys learn anything from Dryad: http://en.wikipedia.org/wiki/Dryad_(programming) ?

                          147 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            6 comments  ·  Flag idea as inappropriate…  ·  Admin →

                            We have recently added support for OSS APIs like MongoDB and Gremlin, so that you have the freedom of choice among cloud providers and programming APIs, while taking advantage of Azure Cosmos DB’s capabilities like SLAs, global distribution, and predictable performance.

                          • 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…

                            121 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 →
                            • EventGrid publisher for CosmosDB

                              Instead of, or in addition to, the existing ChangeFeed please publish changes to Event Grid.

                              This shud be mngt ops like DB create, collection create etc.
                              AND changes to documents, including deletes.

                              112 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                7 comments  ·  Flag idea as inappropriate…  ·  Admin →

                                We have reviewed this and have elected to not include this on our road map for the time being. We may revisit this in the future so will leave as unplanned rather than declined or closed.

                                Thanks for your suggestion and comments.

                              • Support for W3C SPARQL as a query language

                                SPARQL is a mature W3C standard for querying and updating graph-like data with well defined semantics and rich query capabilities.

                                http://en.m.wikipedia.org/wiki/SPARQL

                                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…)
                                  4 comments  ·  Gremlin API  ·  Flag idea as inappropriate…  ·  Admin →
                                • Support documents up to 16mb

                                  It's not possible to migrate documents greater than 2mb, please consider increase document size up to 16mb

                                  86 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  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Make triggers automatic

                                    Right now, triggers are not automatic meaning that they must be specified on each database operation where you want them to be triggered. This means that there is no way to ensure that business rules and other constraints are maintained. I have resorted to telling other developers never to hit the database directly but instead use the set of sprocs established to maintain constraints. It seems to work for us because we're small, but I can imagine that in a larger development team, someone will hit the database directly bypassing your sprocs and risk violating your desired constraints.

                                    Triggers provide…

                                    83 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  ·  Flag idea as inappropriate…  ·  Admin →

                                      This is not on our roadmap. As you correctly pointed out there are or can be issues making these automatic that could impact performance. Our recommendation is these should be explicit in your app.

                                      Thank you for your suggestion. We will revisit this again sometime in the future.

                                    • 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)

                                      79 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 →
                                      • Increase 10GB limit on non partitioned collection

                                        Give there is a hard 10GB limit on a non-partitioned collection, and partition collections are much more expensive, with no auto-upgrade and code changes required to migrate to partitions, a larger size limit on non partitioned collection is much needed.

                                        69 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  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Support multiple collections in stored procedures

                                          Currently CosmosDB Stored procedures only allow access to a SINGLE collection (because they seem to be scoped to collections rather than to the database), via getContext() :

                                          var collection = getContext().getCollection();

                                          But any "useful" / "real-life" application using ComosDB will typically have to interact with more than one collection. For example, it is currently IMPOSSIBLE to insert documents into two distinct collections within a database using a single stored procedure -- a VERY SERIOUS drawback / limitation.

                                          I would propose that stored procedures be scoped to the database level and then we would be allowed to do something like:

                                          var…

                                          68 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3
                                          • Don't see your idea?

                                          Azure Cosmos DB

                                          Feedback and Knowledge Base