Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
MongoDB: Querying layers of objects and arrays

I am very much a beginner in NoSQL. can someone help me with the query that would find all of the documents that are "Point" geojson types in my collection?

Here is an example document:

    {
    "_id" : ObjectId("5886276637ccefbcc5c84db2"),
    "docId" : "10bc70fb2d709f7f51b6a2cae363c8f46786fb113bc6165fb0d45e24086197fd",
    "entities" : [ 
        {
            "geoJson" : {
                "type" : "Point",
                "coordinates" : [ 
                    "16.44184", 
                    "100.34879"
                ]
            },
            "isNormalised" : false,
            "confidence" : 1.0,
            "externalId" : "1ee5f6e691a43e0f34b65f9c95b4443dc9809c496d9c825f251c9883e4bf5e28",
            "end" : 2746,
            "subType" : null,
            "type" : "Location",
            "begin" : 2740,
            "value" : "Pichit"
        }
    ]
}

and in Robomongo visual:

Robomongo screenshot of document

I am getting lost because of the array (entities) of objects (0) which have objects (geoJson) which have elements (type). I have read the following and while they the answers on them make sense to me, I can't seem to fix my confusion on my example.

Mongo db - Querying nested array and objects

Querying an array of arrays in MongoDB

What query do I need and can you elaborate the explanation of each level?

Just to be clear the entities array can have any number of objects so the query needs to check all objects in that array, not just "0" as i nthe example image below:

Example with multiple objects in the array

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The query will be as simple as:

db.collection.find({"entities.geoJson.type": "Point"});
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!