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 8426669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:35:34+00:00 2026-06-10T04:35:34+00:00

We have a mongo collection that can be search&sorted on many fields. For example

  • 0

We have a mongo collection that can be search&sorted on many fields. For example (sorry I can’t put the real collection due to confidentiality), let’s take:

MathProblem
{
    Creator : String,
    Difficulty : integer (from 0 to 4),
    Categorie : integer (from 0 to 40),
    NbOfQuestion : integer (less than 20),
    Likes : integer,
    Dislikes : integer,
    Succeeded : integer,
    Failures : integer
}

We can search on Creator, Difficulty, Categorie , NbOfQuestion . And sort by likes, dislikes, succeeded and failures.

Ex:

  • Give me the problems of difficulty 3, with a categorie 20 sort them
    by # of likes.
  • Give me the problems with 5 questions sort them by failures.
  • Give me problems with difficulty 1, categorie 10, 2 questions and created by Einstein.
  • Give me all problems sorted by Succeeded.

Etc… you get the picture all the permutation are possible and we optionaly sort on one field.

Problems here, is that we have millions of record. Indexing cost us at least 30 gig. Also, because we have so many indexes, it crushes the writing speed on this collection. And while it’s crushing the writing, it’s locking the reading. So we have a lot of read and a possibly little bit less of write, but still a lot.

I search for a “search engine solution”, but I could only find thing on “full text search” which is not my case.

We also tried to merge the difficulty, Categorie and NbOfQuestion in one array (by multiplying value by a 10 factor to keep them appart) to index only on this array and save some space.

Any hindsight will be greatly appreciated!

Thanks,

Charles

  • 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-10T04:35:36+00:00Added an answer on June 10, 2026 at 4:35 am

    Charles,

    There is no simple solution to your issue. Probably the best solution for now would be to scale outwards using MongoDB’s sharding functionality. http://www.mongodb.org/display/DOCS/Sharding+Introduction

    The aim here would be to split your working set over a number of machines to lower the amount of data that would be “crushed” by one write. Additionally i can suggest upgrading to atleast MongoDB v 2.0.7 as there are number of new features (such as yield-on-long-operation and yield-on-page-fault) in the 2.X branch which are designed to reduce the impact of write locks on your system. More info on MongoDB concurrency can be found http://www.mongodb.org/display/DOCS/How+does+concurrency+work

    Cheers,

    David

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

Sidebar

Related Questions

In Mongo my understanding is that you can have databases and collections. I'm working
I have many collections of documents in a mongo database that look like this:
I have a mongo collection which has documents with two fields fieldA and fieldB,
I have a Mongo collection that simply references an ID to another collection. Hypothetically
I have a database connection that I got like this: db = Mongo::Connection.new.db(app-development) but
I have a collection in mongo in which I am inserting data from Perl
I have an existing mongo database where all documents in a collection have a
Just started mongo and started having issue with querying already. i have a collection
How can I have a mongo query similar to the SQL ...WHERE _id >
I'm looking to compare fields between potentially millions of documents within a mongo collection.

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.