Skip to content

Instantly share code, notes, and snippets.

@blackwright
Last active April 28, 2017 14:35
Show Gist options
  • Save blackwright/c30a1db5bcae85933f54bf3378fa0bf9 to your computer and use it in GitHub Desktop.
Save blackwright/c30a1db5bcae85933f54bf3378fa0bf9 to your computer and use it in GitHub Desktop.
Mongoose REPL
var mongoose = require('mongoose');
var repl = require('repl').start({});
var models = require('./models');
require('./mongo')().then(() => {
repl.context.models = models;
Object.keys(models).forEach((modelName) => {
repl.context[modelName] = mongoose.model(modelName);
});
repl.context.lg = (data) => console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment