Importing GeoJSON data into MongoDB

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' 

Importing Data - MongoDB

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",

Getting MEAN with Leaflet Markers

Over the past week, in between meetings, I've gotten some additional functionality added. I've been able to enter a number of Leaflet nodes (records) and then display markers on the "list" view. I've created a link in the popup that then takes us to the detail record. I've also been taking Dan Whalin's Udemy course. His site has a 50% off coupon code.

The MEAN Stack and Leaflet - My Notes

I've been looking at how to refactor our campus maps app from being Drupal based to sometihng that is based on a RESTful API so that data can be easily shared with other apps. Drupal has gotten us a long way, but the map stack of modules we're using has some limitations. I need to pull some custom map work stored at giving us deeper zooms and styling rules we've decided upon.

The MEAN stack offers one refactoring option. So, I spent Christmas vacation doing some reading, configuring and thinking about how the MEAN stack might work for our needs.