UPDATE: As Dan pointed out - eval still seems to be the only way in MongoDB.
I have a collection (organizations) looking like this:
{
"_id": ObjectId("531d26898aa08582df2a65ac"),
"country_code_id": 56,
"created_at": "2012-06-16 18:37:13",
,
"geopoint": [
],
"id": 46773,
"latitude": 50.9571,
"longitude": 6.91227,
"name": "xyz",
"postalcode": "50825",
"scheduled": null,
"state": null,
"updated_at": "2012-06-16 18:37:13"
}
Now I have to combine "longitude" and "latitude" and write them to the array "geopoint" in order to create a 2d index. I could get all documents and iterate over the result but that is not doable at 9+ million documents.