mongodb - Selecting from a IMongoQueryable collection with a Linq Expression throws an error [c# driver 2.2.4] -


using mongodb c# driver 2.2.4, selecting imongoqueryable collection linq expression throws error because of id field. here code:

mongodb.driver.mongoclient myclient = new mongodb.driver.mongoclient("mongodb://localhost:27010");             var db = myclient.getdatabase("your_mongodb_database");             var collection = db.getcollection<man>("test");             var queryablecollection = collection.asqueryable();              man obj = new man() {id = "man1_671", name = "patrick"};             collection.insertoneasync(obj).wait();             // insertion works fine              system.linq.expressions.expression<func<man, man>> func = mec => new man             {                 id = mec.id,                 name = mec.name             };              // line bugs using 2.2.4 driver , works using 2.2.1 version             var listprojection = queryablecollection.select(func).tolistasync().result; 

obviously have rename property '_id' (tested, works), don't why used work (especially because stated no breaking changes have been introduced). using bug had been fixed ? bug in driver ? appreciated :)

edit 1: exception thrown : element 'id' not match field or property of class mongodbhierarchicalstoring.man.

regards, florent


Comments