Hi, just trying to understand the basic geospatial data & queries. In
Exploring the Data
I inspected an entry in the newly-created restaurants collection in
mongosh, with
db.restaurants.findOne()
which returns a document like the following:
{
location: {
type: "Point",
coordinates: [-73.856077, 40.848447]
},
name: "Morris Park Bake Shop"
}
However, what I found in the MongoDB Atlas UI, the actual record looks like this:
{"_id":{"$oid":"5eb3d668b31de5d588f4292e"},"address":{"building":"1007","coord":[{"$numberDouble":"-73.856077"},{"$numberDouble":"40.848447"}],"street":"Morris Park Ave","zipcode":"10462"},"borough":"Bronx","cuisine":"Bakery","grades":[{"date":{"$date":{"$numberLong":"1393804800000"}},"grade":"A","score":{"$numberInt":"2"}},{"date":{"$date":{"$numberLong":"1378857600000"}},"grade":"A","score":{"$numberInt":"6"}},{"date":{"$date":{"$numberLong":"1358985600000"}},"grade":"A","score":{"$numberInt":"10"}},{"date":{"$date":{"$numberLong":"1322006400000"}},"grade":"A","score":{"$numberInt":"9"}},{"date":{"$date":{"$numberLong":"1299715200000"}},"grade":"B","score":{"$numberInt":"14"}}],"name":"Morris Park Bake Shop","restaurant_id":"30075445"}
So is the db.restaurants.findOne()
a function that is doing its own data massaging?
As I want to understand what data format I can/should use for geospatial data in my DB, so that I can make use of the geospatial queries, yet, what the above query returned differs greatly with what was stored.
Any clarification/explanation please? thx.