linq - Access Documents in CosmosDB via the Nuget package when only some have a particular field -
i have collection in cosmos db of documents have field called "flag" , don't. so, example, might have document looks this...
{ "id": "this" }
and looks ...
{ "id": "that", "flag": "true" }
using documentdb nuget package accessing collection ...
const string url = "https://some-made-up-name.documents.azure.com:443/"; const string access_key = "some_made_up_access_key"; const string database = "database"; const string collection = "mycollection"; var _feedoptions = new feedoptions { maxitemcount = 1000 }; using (var _client = new documentclient(new uri(url), access_key)) { var list = _client.readdocumentfeedasync(urifactory.createdocumentcollectionuri(database, collection), _feedoptions).result; list.select(a => new { a.id, a.flag }) .tolist() }
if run error "property 'flag' not in document.
is there way of formulating query "null" or "undefined" or documents "flag" isn't defined , actual value is?
Comments
Post a Comment