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",
      "coordinates": ["36.981798, -122.050032"],
      "created": "2015-01-29 " // yyyy-mm-dd
    },
    {
      "name": "TAPS Parking Lot 108 - Cowell College",
      "coordinates": ["36.997739, -122.053217"],
      "created": "2015-01-29"
    }
]
 
Found this article very helpful. 

Add new comment

By submitting this form, you accept the Mollom privacy policy.