MongoDB

By peterm, 23 April, 2015

Well, I'm no expert but here's a tip that might save you some time. I have a Drupal databae outputting valid GeoJSON data. Our data looks like this:

{

"type": "Feature",

"geometry": {

"type": "Point",

"coordinates": [

-122.0570486784,

36.99607280576

]

},

"properties": {

"name": "Dean of Students Office",

"description": null,

"Food Type": "",

Tags

By peterm, 15 April, 2015

Update 5/1/15 - On a different instance of Mongo, I had run the command noted below and got errors. However, this worked:

mongoimport --db mean-dev -c points --file "points.geojson" --jsonArray

 

Let me save you the hours lost in trying to figure out getting GeoJSON features into individual documents in a collection versus one document with nested features.

MongoDB 3.0.2. Valid GeoJSON file full of 809 features.

Using this code:

mongoimport --db test --type json --file ./'mobilemaps.geojson' 

Tags

By peterm, 27 January, 2015

Importing to Mongo via jsonArray

mongoimport -d meanjs-leaflet4-dev -c leaflets -f name,coordinates --type json --file building-addresses.json --jsonArray

// sample file

// notes - coordinates needs to be bracketed to indicate an array otherwise we get string

// created - use a yyyy-mm-dd for basic entry

    [

    {

      "name": "Cowell College - Apartment  2",

Tags