Skip to content

support get_item in JsonObject #3321

Open

Description

I have a migrations for which i describe query in a form of Expression<Func<JsonObject, bool>> and this expression will get translated to SQL and sent to cosmos and than the migration run on subset of database. So far so good. Now i have migrated most of the codebase to the System.Text.Json I want to make this work with JsonObject instead of JObject

Now something like this wont work because expression visitor is complaining about get_Item method not supported

 var key = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
var client = new CosmosClient("https://localhost:8081/", key);
var container = client.GetContainer("wont-be-needed", "does-not-matter");

IOrderedQueryable<JsonObject> queryable = container.GetItemLinqQueryable<JsonObject>();
IQueryable<JsonObject> queryable1 = queryable.Where(f => (string)f["id"] == "fooBar");

queryable1.ToQueryDefinition();

https://gist.github.com/vmachacek/09d27a9f552bc94e3d7b11453b67f94e

I want query defined as (string)foobar["prop"] == "bar" work with JsonObject same as it is working with JObject

I have considered keeping dependency on Newtonsoft.

Broader question is what are the plans for integrating System.Text.Json into the SDK, or what course of action i should take?

exception Method 'get_Item' is not supported., Windows/10.0.22000 cosmos-netstandard-sdk/3.28.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

  • Status

    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions