Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:47:58+00:00 2026-06-04T09:47:58+00:00

Are either of these methods more optimized for querying using Mongo Db Driver for

  • 0

Are either of these methods more optimized for querying using Mongo Db Driver for C# than the other?:

var partsLogs = MvcApplication.MongoLoggingDatabase.GetCollection(“PartDetailLog”)
.FindAll()

           .Where(x => x.UserId == UserId)
           .Select(x => new RecentActivityPartsLogDto { OemCode = x.Request.OemCode, OemPartCode = x.Request.OemPartCode, OemPartDescription = x.Request.OemPartDescription, TimeStamp = x.TimeStamp, UserId = x.UserId.ToString() })
           .OrderByDescending(x => x.TimeStamp)
           .Skip(pageSize * (page - 1))
           .Take(pageSize);

Or

var doc = new QueryDocument();
doc[“UserId”] = UserId;

var partsLogs = MvcApplication.MongoLoggingDatabase.GetCollection(“PartDetailLog”)

 .Find(doc)              
           .Select(x => new RecentActivityPartsLogDto { OemCode = x.Request.OemCode, OemPartCode = x.Request.OemPartCode, OemPartDescription = x.Request.OemPartDescription, TimeStamp = x.TimeStamp, UserId = x.UserId.ToString()})
           .OrderByDescending(x => x.TimeStamp)
           .Skip(pageSize*(page - 1))
           .Take(pageSize);

Are there other recomendations to make this query better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:47:59+00:00Added an answer on June 4, 2026 at 9:47 am

    The first one will pull back every document and filter it client side where the 2nd will filter the documents server side and only pull back the ones that match. Use the 2nd one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does either of these methods use more memory than the other or put a
Either of these options would be fabulous: Send a bitmap image of the stage's
I want to make a window manager in either of these languages (Preferably ruby).
When I add either one of these ... <%@ OutputCache Duration="600" Location="Any" VaryByParam="*" %>
I am looking into using either of mentioned ways of dealing with long running
I've been using extension methods a lot recently to help make my code be
As a graphic designer, I am wondering if either: there is a WordPress plugin
I want to allow users to either have there username field empty at any
Hi out there in Stackland. I was wondering if there was either a function
Are there existing template extract libraries in either python or php? Perl has Template::Extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.