Back to Catalog
Some things about the official drive integration IQueryable, there are good things and bad things, and the good thing is that it will translate your LINQ statements into MongoDB statements very friendly, and the bad thing is that some LINQ statements will not be translated, the cost of not being translated is to load the entire result set into memory, Then the LINQ to Object query, the efficiency is very low, hehe.
Good
Added support for IQueryable extension methods in the latest official drivers
Public Static Imongoqueryable<tdocument> asqueryable<tdocument> ( this imongocollection<tdocument> collection);
1 It completes support for where
" Zzl ");
2 It fully supports the group
var g = _webmanageusersrepository.getmodel () new { = I, = v.count () });
We can see the MONGODB statement generated by the breakpoint, then we can put the statement on the command line to perform a look at the specific effect
Bad
Not supported for count () method completion, deprecated, if count () is used, it is recommended to use MONGO, rather than LINQ
Stopwatch SW1 =NewStopwatch (); SW1. Restart (); varA1 = _webmanageusersrepository.count (i =true);//Good performanceSW1. Stop (); varAT1 =SW1. Elapsedmilliseconds; Stopwatch SW=NewStopwatch (); Sw. Restart (); varA = _webmanageusersrepository.getmodel (). Count ();//Poor performanceSW. Stop (); varat = SW. Elapsedmilliseconds;
Back to Catalog
MongoDB Learning Notes ~ Some things after the official drive integration IQueryable