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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:50:55+00:00 2026-05-26T23:50:55+00:00

My object is like following. { _id : ObjectId(4ec3ba6fb8af0adbaf2ffc2a), list : { list1 :

  • 0

My object is like following.

{ "_id" : ObjectId("4ec3ba6fb8af0adbaf2ffc2a"), "list" : { "list1" : "sample", "list2" : "test2" } }

I want to count total record under “list”. Can I do this in shell ?

  • 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-26T23:50:55+00:00Added an answer on May 26, 2026 at 11:50 pm

    I don’t think there are any queries on the database side for that. You could use simple map/reduce but in your case probably the easiest way is to just fetch the whole document and then count the items with javascript loop like this:

    document = db.yourcoll.findOne(...);
    var count = 0;
    for (e in document.list) { ++count; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: SELECT o.id,o.name FROM object o WHERE ( o.description LIKE
I'd like to return an object with the following signature class AnonClass{ string Name
I have a class like the following: class Positive(object): def __init__(self, item): self._validate_item(item) self.item
Given an object like: class M(models.Model): test = models.BooleanField() created_date = models.DateTimeField(auto_now_add=True) Given sample
Filtering QuerySets in Django work like the following: Entry.objects.filter(year=2006) How can I use filter
I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php
I created a hierarchy of case objects in Scala that looks like the following:
How does container object like vector in stl get destroyed even though they are
If I create an object like so: class Foo { [Bindable] public var property:
I have an on object like so var obj = {}; function set() {

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.