goosecon is a Mongoose REPL Console that auto-loads mongoose models and additional app-specific modules (services/helpers). Inspired by rails console.
Install globally:
$ npm install -g goosecon
Run goosecon
in your app directory:
$ cd app-directory
$ goosecon
Perform a mongoose query with any of your models
> Person.findOne({name: 'Matt'}).populate('pets')
The only required option is the MongoDB url:
$ goosecon --mongo-db 'mongodb://localhost/db-name'
By default, goosecon will search through the working directory for a models
directory and attempt to load any mongoose models.
You can also specify a models
directory:
$ goosecon --models-dir './path/to/models'
As an alernative to the command line options, you can create a .gooseconrc
configuration file and place it in your app directory.
{
"mongoDb": "mongodb://localhost/db-name",
"modelsDir": "./path/to/models",
"mongooseDir": "./node_modules/mongoose",
"modules": [
"./path/to/services",
"./path/to/helpers"
]
}
Other modules/services/helpers can be loaded with the modules
option.
If your mongoose queries seem to stall out, you may need to tell goosecon to use your app's mongoose package
$ goosecon --mongoose-dir './node_modules/mongoose'