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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:23:36+00:00 2026-06-02T11:23:36+00:00

Mongo finding items through sub-object { _id : ObjectId(4f93aaddaca610f76b000000), count : NumberLong(2), items :

  • 0

Mongo finding items through sub-object

 { "_id" : ObjectId("4f93aaddaca610f76b000000"),
   "count" : NumberLong(2),
   "items" : [
            {"count" : NumberLong(1),
             "options":{ "1":"track","2" : "track" } },

            {"count":NumberLong(2),
             "options":{"1":"as","2" : "sadf" } }
             ]
 }

How to sort the things in the sub-objects like limit the items list per request

result i expect is this

 { "_id" : ObjectId("4f93aaddaca610f76b000000"),
   "count" : NumberLong(2),
   "items" : [
            {"count" : NumberLong(1),
             "options":{ "1":"track","2" : "track" } },
             ]
 }
  • 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-02T11:23:48+00:00Added an answer on June 2, 2026 at 11:23 am

    No, you can’t do that. Querying embedded arrays is pretty limited now. Some day we’ll have virtual collections (SERVER-142) and we’ll be able to do sort , skip, limit and all other usual things. But right now we have these options:

    • Fetch whole subarray and process it in the application;

    • Move items to their own collection (reference instead of embedding);

    • Use Aggregation Framework (not yet released);

    • Give up the idea.

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

Sidebar

Related Questions

I have a collection of the following sort of documents (taken from Mongo DB
Mongo has the nice operator $slice, which let's you only retrieve a sub sets
I have the following mongo document: { _id: 'someid', name: 'John Doe', address: {
Being relatively new to mongo, I read in the mongo manual about Optimizing Object
Sort of a mongo noob, and I have a feeling I am tackling this
Mongo docs state: The Mongo multikey feature can automatically index arrays of values. That's
In Mongo my understanding is that you can have databases and collections. I'm working
The PHP Mongo Driver allows me to execute code in the database. Does this
I am new to the mongo db.I just installed it over my ubuntu 11.04
I need to use the mongo-storm library and Clojars doesn't have it . So

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.