goosecon
v0.2.2
Published
Mongoose Console that auto-loads models and other app modules
Downloads
4
Readme
goosecon
goosecon is a Mongoose REPL Console that auto-loads mongoose models and additional app-specific modules (services/helpers). Inspired by rails console.
Installation
Install globally:
$ npm install -g goosecon
Usage
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')
Options
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'
.gooseconrc
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.
Note: Fix query stalling error
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'