Fixtures have been a staple of RoR development to help seed data for testing your applications. You can bring this awesome aspect of development to your nodejs apps in a snap.

Step 1: install pow-mongodb-fixtures

npm install -g pow-mongodb-fixtures 

Step 2: create a fixture file per model

The contract for this really allows you to do more than one in each file, but i think that's a bit more straight forward to just limit this to one collection. I've also found that this works better if you use real objectIDs so that you can rerun the fixtures over and over. Just create the file in a folder named "fixtures" in your project root. Here's an example of my fixtures/posts.js fixture:

var ObjectId = require('pow-mongodb-fixtures').createObjectId;

exports.posts = [
{
	"slug": "quicktips-nodejs-fixtures",
	"title": "QuickTips: nodejs fixtures",
	"categories": [],
	"state": "draft",
	"_id": ObjectId("54a32975e71789c451b66644"),
	"__v": 0
}

Step 3: run your fixtures

just specify your target database and directory your fixtures are in

mongofixtures make-and-build fixtures

happy coding