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. Allow multi Order By

    From what I see it is impossible to run a query with more than one column in the Order By.

    532 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
    • Support ORDER BY on the ST_DISTANCE spatial function

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

      264 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        12 comments  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
      • Cosmos DB BulkExecutor for .NET Core

        I would like Azure Cosmos DB BulkExecutor library for .NET Core compatible version.

        Recent application often uses Microsoft.Azure.DocumentDB.Core package, so the need for the .NET Core version is high.

        248 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
        • Support LINQ ANY or WHERE for child object collections

          Example trying to query Sales

          var querySales = DocumentDb.Client.CreateDocumentQuery<Sale>(collectionLink)
          .Where(q => q.Type == "Sale" && q.Stage <= 99 && q.InvolvedParties.Any(qq => qq.Id == userId))

          Buy ANY not supported

          Also tried
          .Where(q => q.Type == "Sale" && q.Stage <= 99 && q.InvolvedParties.Where(qq => qq.Id == advisorUserId).Count() > 0)

          get WHERE not supported

          Really want the DB to perform the search as a lot of results will come back.

          sample data:
          {
          "id": "af10eebf-b0b6-49d5-8db5-96f54c4985d2",
          "Type": "Sale",
          "GroupId": 1,
          "InvolvedParties": [
          {
          "Id": "344595a3-4e73-4bd5-9988-849858f045f1",
          "PartyType": 0,
          "Name": "test user"
          }
          ],

          130 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 →

            We have started work on this feature and plan to release it in an upcoming release. I cannot give an exact date but this should be released soon. Will update here once a date is known or once it is publicly available.

            Thank you for your suggestion.

          • Make COUNT() aware of indexes

            Queries with COUNT() or other aggregates are very expensive and all appear to be scan driven vs. index driven.

            I have 50k documents in collection, each has "Type" property with string value. The indexing policy is default.

            The following simple query consumes 615 RUs:
            SELECT VALUE COUNT(1) FROM x WHERE x.Type ='Content'

            The result is 9738 records.

            The query metrics are:
            RetrievedDocumentCount: 9738
            RetrievedDocumentSize: 69506571
            OutputDocumentCount: 1
            OutputDocumentSize: 53
            IndexHitDocumentCount: 0
            IndexHitRatio: 0

            So what we see is that database reads all "Contents" and than counts them. But it's enough to just count the index entries not to read all…

            61 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
            • Deploy Stored Procedures from Source Control

              It would be great if we could deploy sprocs from visualstudio.com as we can with Azure Functions or Azure Web Sites.

              57 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 →
              • Order By Null Handling

                Currently if you do an order by on a nullable value, the documents are not returned at all. Please add functionality similiar to Application Insights where you can specify if the documents with the null value appear at the beginning or end of the sort.

                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…)
                  2 comments  ·  SQL API  ·  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…

                  50 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 →
                  • Permit executing a stored procedure from another stored procedure

                    function () {

                    var context = getContext();
                    var collection = context.getCollection();

                    collection.executeStoredProcedure('foo', {}, function (error, result){});

                    }

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

                      You can call a UDF from a stored procedure, however you can’t do crud operations within a UDF.

                      This is not on our roadmap. If you can provide more details around why/how you’d need to call a stored procedure from a stored procedure please comment/vote.

                      Thanks for your suggestion.

                    • stored procedures & functions in .NET (C#)

                      Would be great to have the option to implement stored procedures, functions and triggers in .NET (C#) as well.

                      46 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                      • The ability to reference JavaScript libraries (e.g. underscore) within server-side scripting

                        It'd be nice to be able to reference javascript libraries within server-side scripting. Something like an AMD or RequireJS loader.

                        For example:
                        var _ = require('lodash');

                        43 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                        • Add DateTimeOffset support

                          The DocumentDb engine should be able to recognize and properly order DateTimeOffset serialized fields.

                          42 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                          • Add built-in cast function for SQL queries

                            Need built-in function for casting string datatypes to INT, NUMBER, DOUBLE, etc. in SQL queries as our data loader is converting the number to string during document creation. We have a requirement to filter on numeric values in our application.

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

                              This is on our roadmap and work has started on implementing this feature. We do not have an ETA on when this will be released but it should be within the next 2-3 months. Will update with an ETA when this feature gets closer to completion.

                              Thank you for your suggestion.

                            • Use Json.Net contract resolver when using Linq to generate SQL queries

                              Member names in SQL queries generated from Linq currently look at the member for either a JsonPropertyAttribute or DataMemberAttribute. If the ability to specify custom JsonSerializerSettings is implemented (see http://feedback.azure.com/forums/263030-documentdb/suggestions/6422364-allow-me-to-set-jsonserializersettings ), this will need to be implemented to actually remove the need to annotate every member of your data object classes.

                              28 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                              • 26 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                                • DocumentDB driver/package for R

                                  There is one for MySQL. Not sure how hard it would be to build one for DocumentDB.

                                  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…)
                                    1 comment  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Include documentdb in Stack.

                                    Include support of documentdb in Azure Stack. So that an application already running on Azure live can also be used on Azure Stack.

                                    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…)
                                      0 comments  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                                    • monitor and kill queries

                                      Add ability to monitor (ie. see SQL query) and kill long running user queries from within Data Explorer.

                                      13 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Support Querying a Subset of Logical Partitions in a Partitioned Collection

                                        With the 10GB limit for a logical partition, there is a possibility where a partition key cannot be broken down far enough to avoid the upper limit without implementing a partitioning scheme similar to:

                                        Partition Keys:
                                        {Tenant Id}{Document Type}{Partition 1}
                                        {Tenant Id}{Document Type}{Partition 2}
                                        {Tenant Id}{Document Type}{Partition 3}
                                        .
                                        .
                                        .
                                        {Tenant Id}{Document Type}{Partition N}

                                        Where N is a defined as the total # of partitions per tenant id / document type combination to have. This is just an example where a single collection contains data from multiple tenants and document types, but could apply to other scenarios as well.

                                        12 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  ·  SQL API  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Fix issue with linq criteria on child object

                                          In a project i'm currently working on, we have come to realise that we should not use DocumentDb collections as if they are the equivalent of a table in f.ex SQL Server. As a result, we are now persisting all of the entities, belonging to a single tenant in a single collection.

                                          We already have lots of linq queries in our codebase which assume that each document type (aggregate root) is persisted in a dedicated collection. In an attempt to make the transition painless, i set out to refactor our data access object, so that its api continues to reason…

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

                                          Azure Cosmos DB

                                          Feedback and Knowledge Base