Easy fixtures for mongodb:
-
Put a fixtures folder in your project
-
Put JSON files in the fixtures folder, with the filenames being the collection-names (plural)
-
Create code similar to:
var fixtures = require('mongodb-fixtures');
var Db = require('mongodb').Db, Connection = require('mongodb').Connection, Server = require('mongodb').Server;
var db = new Db('wines', new Server("localhost", Connection.DEFAULT_PORT, {}));
fixtures.load(); fixtures.save(db, function() { db.close(); console.dir(fixtures); });