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

  • Home
  • SEARCH
  • 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 3783868
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:17:25+00:00 2026-05-19T11:17:25+00:00

MongoDB: var x = nosql.GetRecords<Event>(p => p._Data == rawhix, 0, 12222); // ICursor<T> GetRecords<T>(expression,

  • 0

MongoDB:

var x = nosql.GetRecords<Event>(p => p._Data == "rawhix", 0, 12222);
// ICursor<T> GetRecords<T>(expression, skip, limit);

SQL:

SqlDataReader dr = SqlHelper.ExecuteReader("Select Top(12222)* From NewsFeed WHERE _Data = 'dddd'");

the MongoDB contains 1000000 record which are the same in the SQL .

the data stored as the following:

Id = 1 , _Data = 1abc
Id = 2 , _Data = 2bc 
... etc

Event class :

Class Event => int Id => string _Data 

when I run the code the result is:

Mongo : 580ms
SQL : 102ms

Should I do anything to fix this !! because the mongo was always faster except this test !?!

  • 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-05-19T11:17:26+00:00Added an answer on May 19, 2026 at 11:17 am

    You need an index. Run this in the mongo console:

    db.Events.ensureIndex({_Data:1});
    

    or you can call it through the C# driver:

    MongoDatabase db = server.GetDatabase("your_db_name");
    MongoCollection<Event> events = hr.GetCollection<Event>("events");
    employees.EnsureIndex("_Data");
    

    You wouldn’t want to do this on every call though since it is another call to the DB and will have a very tiny performance hit.

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

Sidebar

Related Questions

I wrote these lines in My Application start event: var mongo = new Mongo();
with MongoDB (and I assume other NoSQL database APIs worth their salt) the ways
I am trying to figure out MongoDB in order to evaluate whether it is
Using MongoDB C# driver ( http://github.com/samus/mongodb-csharp ), seems that I'm unable to get the
I need something slightly more complex than the examples in the MongoDB docs and
is mongodb appropriate for sites like stackoverflow?
In MongoDB, I have a document with a field called ClockInTime that was imported
I am using the MongoDB-Csharp driver and I was wondering what the proper way
Trying to insert into a mongodb database from scala. the below codes dont create
MongoDB has two popular ORMs for Rails: MongoID and MongoMapper. Are there CouchDB ORM:s

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.