Last active
April 28, 2017 14:35
-
-
Save blackwright/c30a1db5bcae85933f54bf3378fa0bf9 to your computer and use it in GitHub Desktop.
Mongoose REPL
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 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