c# - Issue with querying data from mongo for nested elements -
i new mongo db , using c# mongo driver find stuff. below query in robo mongo returns me results.
db.getcollection('mycollection'). find ({ "startdatetime":{ $gte : isodate("2016-12-08t00:00:00.0000z") }, "pages.pageevents.pageeventdefinitionid": luuid("dd6a6fdc-a96a-3f42-a824-49uuee741aa9") });
below way writing c# code. startdatetime
working. not sure how pages.pageevents.pageeventdefinitionid
. pages
collection, pageevents
further collection inside pages
, each pageevent
has pagedefinitonid
. pages
, startdatetime
@ same level in document.
var builder = new querybuilder<mydata>(); var filter = builder.and(builder.gte(_ => _.startdatetime, datetime.now.adddays(-30))); var results= driver.mycollection.findas<mydata>(filter).select(x => x);
Comments
Post a Comment