MongoDB Learning Notes ~ Some things after the official drive integration IQueryable

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.