MongoDB SSIS with $unwind -


i started using mongodb source in ssis (using c# driver). new mongodb , c#. when did not have nested documents, statements below worked me:

var query = query.and(query.or(query.gt("createdon",maxupdatedonbson), query.gt("updatedon", maxupdatedonbson)),              query.or(query.lt("createdon", cutoffdate), query.lt("updatedon", cutoffdate)),query.in("testtype", testtypes) );        mongocursor<bsondocument> toreturn = collection.find(query); 

now, got nested documents. able create java script, , works mongodb itself

db.test.aggregate( [  { $unwind : { path: "$items",includearrayindex: "arrayindex"} } , { $match:  { $and: [         {$or: [ { createdon: { $gt: isodate("2015-11-22t00:00:00z")} }, {updatedon: { $gt: isodate("2015-11-22t00:00:00z") } } ] },         {$or: [ { createdon: { $lt: isodate("2016-05-09t00:00:00z")} }, {updatedon: { $lt: isodate("2016-05-09t00:00:00z") } } ] }                    ] }  }] ) 

in c#, understand, have use aggregate instead of find cannot translate code c#. still have selection criteria , unwind.

can please help?

because there no collection template posted, i'm attaching snippet similar looking for. help?

       var builder = builders<bsondocument>.filter;        //and operator can used similar below using operator "&" or builder.and.           var filter = builder.eq("state", "nj") | builder.eq("state", "co");          var filter2 = builder.eq("pop", 6033) | builder.eq("city", "nyc");         filter = builder.and(filter, filter2);         var pipeline = grades.aggregate()             .unwind(x => x["items"])            .match(filter);           var list = pipeline.tolist();          foreach (var item in list)         {             //do         } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -