Giter Site home page Giter Site logo

Stop requiring partition key parameter in the typed create, replace, upsert methods, infer from the data about azure-cosmos-dotnet-v3 HOT 8 CLOSED

azure avatar azure commented on September 18, 2024 3
Stop requiring partition key parameter in the typed create, replace, upsert methods, infer from the data

from azure-cosmos-dotnet-v3.

Comments (8)

kirillg avatar kirillg commented on September 18, 2024 3

For the typed programming model, we will stop requiring partition key value in the method signature/infer it from the body. For the stream, we would like to avoid parsing the stream.

from azure-cosmos-dotnet-v3.

christopheranderson avatar christopheranderson commented on September 18, 2024 2

Sorry this change wasn't super clear. We'll use this issue to track this change. (I'll change the title)

v3 currently only works with partitioned containers. We're working on a backend feature that will make non-partitioned containers able to act like partitioned containers (but you can just pass null as the partition key if you want to not think about it). You can expect that be out in Jan/Early Feb. That release will also block creation of new non-partitioned containers via the v3 SDK (which is still currently possible in v3 today).

For now, you'll need to use v3 only with partitioned containers.

from azure-cosmos-dotnet-v3.

manigandham avatar manigandham commented on September 18, 2024

They mean different things:

When creating a container, you're specifying what field in the documents to use as the partition key for sharding the collection.

When manipulating the resources, you're specifying the actual value for the partition key (field) so that Cosmos DB knows which partition to route to.

from azure-cosmos-dotnet-v3.

matthewhancock avatar matthewhancock commented on September 18, 2024

They mean different things:

When creating a container, you're specifying what field in the documents to use as the partition key for sharding the collection.

When manipulating the resources, you're specifying the actual value for the partition key (field) so that Cosmos DB knows which partition to route to.

But a Resource modification is done within the context of a Collection, so couldn't the Partition Key Path be mapped to the respective property on the Resource automatically based on the Collection it was going to?

from azure-cosmos-dotnet-v3.

Elfocrash avatar Elfocrash commented on September 18, 2024

@kirillg Shouldn't this also be the case for the SQL execution path? I'm talking about CreateItemQuery and CreateItemQueryAsStream methods which also require the partition key. I thought the server would infer the partition key from the query anyway if the request is marked as a cross partition query (which currently is an internal property).

from azure-cosmos-dotnet-v3.

mdrichardson avatar mdrichardson commented on September 18, 2024

v3 currently only works with partitioned containers. We're working on a backend feature that will make non-partitioned containers able to act like partitioned containers (but you can just pass null as the partition key if you want to not think about it).

@christopheranderson How's this change coming along? I'm porting over from DocumentDB for the Bot Framework team and am running into this issue on the C# side. Node side is working great, though!

Regarding OP's issue, more specifically, I'm also running into this. If I'm using await _container.Items.UpsertItemAsync..., should it not infer the correct partitionKey from the _container? Similarly, it makes it a little difficult to strongly type document upserts if the item needs to have { <myPartitionKeyName>: <myPartitionValue> } instead of something like { partitionValue: <myPartitionValue> } since partitionKey is already required in the upsertItemAsync method.

from azure-cosmos-dotnet-v3.

kirankumarkolli avatar kirankumarkolli commented on September 18, 2024

yes partitonkey and id (for replace) can be inferred. Marking it for GA.

from azure-cosmos-dotnet-v3.

kirankumarkolli avatar kirankumarkolli commented on September 18, 2024

Duplicate of #230

from azure-cosmos-dotnet-v3.

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.