Skip to content

Mongoose Console that auto-loads models and other modules

Notifications You must be signed in to change notification settings

mnort9/goosecon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0a8ce84 · Dec 14, 2015

History

25 Commits
Dec 14, 2015
Dec 11, 2015
Aug 17, 2015
Aug 16, 2015
Aug 20, 2015
Dec 14, 2015
Dec 14, 2015

Repository files navigation

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'

About

Mongoose Console that auto-loads models and other modules

Resources

Stars

Watchers

Forks

Packages

No packages published