a new collection.
On Mon, Nov 1, 2010 at 7:39 PM, D Boyd <db
...@data-tactics.com> wrote:
> Greetings all:
> I am pretty new to Mongo and had a question I hope the group can
> help with.
> I have a number of records in the DB now, that I would like to
> transform server side from their
> current structure into a GeoJSON compliant structure.
> Basically, the records are of the form:
> { id: "id1", att1: "att value", att2: "att 2 value", lat: "34.33",
> lon: "22.34" }
> I need to transform that into GeoJSON of the form:
> { "type": "Feature",
> "geometry": {
> "type": "Point",
> "coordinates": [
> [22.34, 34.33]
> ]
> },
> "properties": {
> "att1": "att value",
> "att2": "att 2 value"
> }
> }
> In my searches I found a couple of interesting Javascript functions
> (jsonT, jsonPath) at http://goessner.net/articles/JsonPath/
> I have successfully stored them inside my mongo instance and was even
> able from the console to execute jsonPath on a result set.
> However the whole syntax with db.eval is klunky and I have read about
> issues with
> it blocking the database.
> There are several brute force approaches that can be written in
> javascript or java to do the work but
> before I tackled those I thought I would ask the list if there was
> some best practice or more elegant
> approach.
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.