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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:13:15+00:00 2026-06-11T17:13:15+00:00

I have a monogoDB which contains data in the following structure: { Locales :

  • 0

I have a monogoDB which contains data in the following structure:

{   "Locales" : {
    "Invariant" : {
      "Checksum" : "7B4C15B697AAFC1484679076667267D2",
      "Metadata" : {
        "app" : {
          "@appType" : "app",
          "@id" : "284896113",
          "categories" : {
            "category" : [{
                "@id" : "6011",
                "@parentid" : "36",
                "@type" : "GENRE",
                "##text##" : "Music"
              }, {
                "@id" : "6016",
                "@parentid" : "36",
                "@type" : "GENRE",
                "##text##" : "Entertainment"
              }],
            "##category" : null
          },
          "rating" : "2.5",
          }
        }
      },
      "ModifiedDate" : ISODate("2012-09-07T09:07:58.218Z")
    }   },   "_id" : "selection/live/app(284896113)"

There’s about 100,000 of them in my database. I need to find out several things. Firstly how many of them have the “categories” array, then how many of those have one or more “category” array underneath them and finally, of those, how many have have a value for ##text##?

Cheers

  • 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-11T17:13:16+00:00Added an answer on June 11, 2026 at 5:13 pm

    You can use $exists:

    db.things.count( { 
       'Locales.Invariant.Metadata.app.categories': {$exists: true }} );
    
    db.things.count( { 
       'Locales.Invariant.Metadata.app.categories.category': {$exists: true }} );
    
    db.things.count( { 
       'Locales.Invariant.Metadata.app.categories.category.##text##': 
          {$exists: true }} );
    

    Note that this will return the count of documents, not the count of matches. In your example, it will return ‘1’ because there is one document, not ‘2’ (for the two occurrences of ##text##).

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

Sidebar

Related Questions

I have this NodeJS app which fetches JSON-type response from a web application and
I have an Android application which sends json data to PHP script. The PHP
say i have two collections in mongodb,one for users which contains users basic info,and
I have data which is organized hierarchically and I'd like to compute aggregations at
I have used mongodb 1.8.1. In which I have collection which contains more than
I have a special list (a sort of queue, as in the data structure,
So I'm building an app using PHP and MongoDB which will have a fair
In MongoDB I have a query which looks like this to find out for
I have a MongoDB collection with data that was not saved through my Derby
I have Django project on Dreamhost server which has several views that returns Json

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.