Last active
January 26, 2016 05:12
-
-
Save tgoyer/26ccc9f1d00a2e7a7b95 to your computer and use it in GitHub Desktop.
Load Data into Mongo / Mongoose using Groceries as an example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GroceryItem = require('./model.groceryitem.js'); | |
module.exports = { | |
load: function() { | |
[{ | |
name: 'Chips', | |
purchased: false | |
}, { | |
name: "Ice Cream", | |
purchased: false | |
}, { | |
name: "Corn", | |
purchased: true | |
}, { | |
name: "Diapers", | |
purchased: false | |
}].forEach(function(item) { | |
new GroceryItem(item).save(); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment