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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:51:24+00:00 2026-06-02T07:51:24+00:00

I have a set of documents that are the same but could be sorted

  • 0

I have a set of documents that are the same but could be sorted into two distinct groups based on usage.

One of these groups, we’ll call them “current”, has a low volume of documents being queried a lot.

The other group, we’ll call them “backlog”, is a huge volume of documents queried much less often.

My thought was that not mixing these these two types of the same document would allow me to query the very active “current” docs without needing to sift through the huge amount of “backlog” every time.

Should these be in two different collections or the same “cars” collection?

mongo.collection('cars', function(err, cars){
    cars.find({type:'new', color:'blue'}).toArray(function(err, newBlueCars) {
        //do something with newBlueCars
    });
});

mongo.collection('cars', function(err, cars){
    cars.find({type:'used', color:'blue'}).toArray(function(err, usedBlueCars) {
        //do something with usedBlueCars
    });
});

OR

mongo.collection('cars.current', function(err, cars){
    cars.find({color:'blue'}).toArray(function(err, currentBlueCars) {
        //do something with newBlueCars
    });
});

mongo.collection('cars.backlog', function(err, cars){
    cars.find({color:'blue'}).toArray(function(err, backlogBlueCars) {
        //do something with usedBlueCars
    });
});
  • 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-02T07:51:25+00:00Added an answer on June 2, 2026 at 7:51 am

    I figured I would post an actual answer, now that it has been sufficiently hashed out in comments (the other answer isn’t quite good enough).

    The benefits of keeping it all in one collection are:

    • Can query all records in a single query
    • Can use sparse index to efficiently index the “current” records

    The downsides of keeping it all in one collection are:

    • Indexes probably need to have the “current” field leading all of them, which takes extra space and makes lookups slower
    • Can’t index multiple fields with a sparse index

    The benefits of splitting them into two collections are:

    • You get a free index, so you don’t need to lead all of your indexes with the “current” field
    • Your “current” data will have much smaller indexes that can easily fit in RAM

    The downsides of splitting them into two collections are:

    • You’ll need to run two queries to do anything with the dataset as a whole, and merge the results
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bat file like below with name myBat.bat 1) @echo off set CLASSPATH=%CLASSPATH%;C:\Documents
I have set linebreak and wrap. The document looks great on my screen but
I have a simple data set, a few collections, not more than 20 documents
Curious problem. I have a set of images with some attributes that I'd like
i have an NSScrollView with an NSView set as its document view. I am
I have set up multiple targets in a single xml file. I expect all
I have set up 2 servers which are linked. From my LOCAL SERVER, I
I have :set hlsearch as default value. When I search for something, search terms
We have set up a SharePoint meeting workspace (using WSS 3.0) for our weekly
I have set up an AJAX contact form on a client's website. The problem

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.