I have a mysql table that has postcode and co-ordinates that I would like to import to Mongo. After exporting to csv and importing to MongoDB it looks like this
> db.postcode.findOne()
{
"_id" : ObjectId("5596d56365f8d76adbae63ed"),
"postcode" : "AB101XG",
"latitude" : 57.14416516,
"longitude" : -2.114847768
}
However, I would like to have the co-ordinates in a array format (assuming it is the format required for geo queries) as below
> db.postcode.findOne()
{
"_id" : ObjectId("5596d56365f8d76adbae63ed"),
"postcode" : "AB101XG",
"loc" : [57.14416516, -2.114847768]
}
Being newbie to Mongo, I am not sure how to achieve it.