I'm importing data from a file into Rethinkdb.
the data looks like this (this is fake data)
[
{
"firstName": "Keeley",
"lastName": "Leannon",
"createdAt": "2016-05-10T19:55:38.823Z",
"location": {
"lat": 52,
"lng": 0.07687,
"lastUpdated": "2016-05-16T03:21:25.082Z"
},
"company": "Breitenberg and Sons",
"jobTitle": "Dynamic Group Facilitator",
"email": "Keeley.Leannon@derrick.com"
},
{
"firstName": "Henri",
"lastName": "Ernser",
"createdAt": "2016-05-21T11:51:54.581Z",
"location": {
"lat": 52,
"lng": -0.74853,
"lastUpdated": "2016-04-28T21:15:26.786Z"
},
"company": "Gleason, Dickens and Cassin",
"jobTitle": "Lead Data Consultant",
"email": "Henri.Ernser@ila.org"
}
]
Now, I want to create point
objects from the location.lng & location.lat fields, and then remove the lat, and lng fields, so the location field would now look like this
"location": {
"point": -0.74853, 52,
"lastUpdated": "2016-04-28T21:15:26.786Z"
},
I'm importing from a file, and as far as i can tell in the docs, there is no way to import directly from a file using ReQL, so i would have to do the import from the command line and then modify each document after the import.
Any pointers on how to go about doing the above?