1
I currently have some objects in a Mongodb database. The structure is as follows.
{
"_id" : ObjectId("55cb9c666c522cafdb053a68"),
"geometry" : {
"type" : "Polygon",
"coordinates" : [
[
[
-73.93383000695911,
40.81949109558767
],
...
]
]
},
"name" : "Central Harlem North-Polo Grounds"
}
Using Delphi I can get an entire object and remove the "_id", that is, my return is a Json with the "Geometry" and the "Name". Follow the code of Delphi.
collection := FMongoConn.Databases['DataBase'].GetCollection('collec');
mqry := TMongoQuery.Create(collection.Env);
mqry := mqry.Project('{_id: false}').&End; //Aqui eu removo o _id que não preciso
Cursor := collection.Find(mqry);
while Cursor.Next do
Cursor.Doc.AsJSON //Json de cada documento
I am trying to get only the object "Geometry" and return it to the Json, have to do this using the procedures of the driver of Delphi (Firedac) or through the find of Mongo?
The intended return would be only this
"geometry" : {
"type" : "Polygon",
"coordinates" : [
[
[
-73.93383000695911,
40.81949109558767
],
...
]
]
}
Through Mongodb himself, it can only bring an entire object?
That’s exactly what I needed, thank you very much, Marcio!
– Bruno Silva