How can we improve Azure Cosmos DB?

Positional array update via '$' query support

668 votes
Vote
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
Prataksha Gurung shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

29 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
An error occurred while saving the comment
  • abcd commented  ·   ·  Flag as inappropriate

    well!!! good news. This feature is supposedly rolling out next week onwards :)

  • Krzysztof commented  ·   ·  Flag as inappropriate

    Hi,
    It would be great to run grandnode on CosmosDB. Without this features application won't work correctly.

  • Ryan J commented  ·   ·  Flag as inappropriate

    This was slated to be fixed April 2018. April is almost over, any news?

  • Sam commented  ·   ·  Flag as inappropriate

    You guys should move this up in the priority queue. Without it you have a create a write lock which is plain dumb.
    So I have to lock the db from writing, query, update and then remove the lock. How do you guys see this as acceptable?

  • Anonymous commented  ·   ·  Flag as inappropriate

    Workaround:
    For example, assuming you have a collection users of following elements:

    {
    "_id" : ObjectId("59d6b719708b990d6c9b3aca"),
    "tags" : [
    {
    "id" : 1,
    "value" : "11"
    },
    {
    "id" : 2,
    "value" : "22"
    },
    {
    "id" : 3,
    "value" : "32"
    }
    ]
    }
    you can issue the following command to get one of the elements (with id =1 in this case) updated:


    db.users.find().forEach(
    function(user)
    {
    user.tags.forEach(
    function(tag)
    {
    if (tag.id=="1")
    {
    tag.value = "Updated!";
    db.users.updateOne({_id : user._id}, {$set: {"tags": user.tags}});
    }
    }
    );
    }
    );

    You can adjust the condition with even finer granularity than positional operator allows.

    Got this reply from Microsoft support. Will this be atomic as findAndModify?

← Previous 1

Feedback and Knowledge Base