Giter Site home page Giter Site logo

Comments (5)

PlagueHO avatar PlagueHO commented on June 11, 2024

Hi @Szeraax - I just saw that too. I'm hoping the REST API's will be updated with this feature as well: https://docs.microsoft.com/en-us/rest/api/cosmos-db/

from cosmosdb.

Szeraax avatar Szeraax commented on June 11, 2024

Closing for now at least.

from cosmosdb.

Szeraax avatar Szeraax commented on June 11, 2024

Hey @PlagueHO, am I reading this right that we now have PATCH capability in the API?

https://learn.microsoft.com/en-us/rest/api/cosmos-db/patch-a-document

from cosmosdb.

Szeraax avatar Szeraax commented on June 11, 2024

Looks like it is supported now and it requires that you use the Patch method with an array of operations. I think the best way to go about implementing this will be to add a PatchOperation type in our module class and then add a Update-CosmosDbDocument cmdlet. Update-CosmosDbDocument would have an optional PartitionKey string param, an optional conditional filter (probably just use -Filter for the param name), and would require an array of the [PatchOperation] objects.

Here is the other document that is helpful to look at: https://learn.microsoft.com/en-us/azure/cosmos-db/partial-document-update

Any guidance on my approach? Cool if I take a first pass at a PR or would you like me to do this in a different way?

from cosmosdb.

Szeraax avatar Szeraax commented on June 11, 2024

Regarding the PatchOperation type, I'd need some help creating that class, since I'm a c# noob at best.

I guess a start would be:

    public class PatchOperation {
        public System.String op { get; set; }
        public System.String path { get; set; }
        public System.Object value { get; set; }
    }

But we'd need to restrict the op to one of the supported operations like add, remove, set, etc. Not sure how to set a validation set in c#. The path would be a string and that's no problem. But the value would need to be any object type that can convert to json (string, int, float, etc.). Dunno how to appropriately do that in the strongly typed world of c#.

from cosmosdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.