Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
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 Respuestas
Responde la pregunta

0

The query will be as simple as:

db.collection.find({"entities.geoJson.type": "Point"});
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda