Skip to content

bagel/mongo-web-shell

 
 

Repository files navigation

mongo-web-shell

A recreation of the interactive mongoDB shell for the browser.

The shell input is initially evaluated in the browser with all appropriate database queries being forwarded to (and returned from) a running mongod instance on the back-end server.

Installation

Requirements:

After the above requirements are installed, clone the repo:

git clone git@github.com:10gen-labs/mongo-web-shell.git && \
    cd mongo-web-shell

Create and activate a virtualenv:

virtualenv venv && \
    source venv/bin/activate

In addition to some git submodules, the back-end dependencies are managed by pip, while the front-end dependencies are managed via npm.

git submodule init && git submodule update
pip install -r requirements.txt
npm install

Grunt is used to build the front-end code.

npm install -g grunt-cli

You will need to set the CLOSURE_PATH environment variable or specify it using closurePath under closure-compiler in Gruntfile.js

Linters

All committed code should be linted.

Front-end: jshint. Installation will occur in the package.json dependencies.

Back-end: pep8. Installation via pip within the virtual environment is recommended:

pip install pep8

Building

The default Grunt task will build the front-end code.

grunt

To perform this build whenever any source files change, use the watch target.

grunt watch

Running

After the installation and build above, launch a mongod instance that will be accessed by the back-end server:

mongod

Then run the server from within your virtual environment:

python run.py

To enable Flask debug mode, which restarts the server whenever any source files change, set the DEBUG environment variable to any value.

DEBUG=1 python run.py

By default, you can connect to the running sample at http://localhost:5000/sample/.

Foreman

The recommended method of running is to use foreman as it performs both the "Building" and "Running" steps above (except for starting a mongod instance).

foreman start -f Procfile.dev

You can create a .env file to specify debug mode and set other environment variables (see the wiki for more). See .env.sample for an example.

Tests

Front-end

Lint the code and run the test suite via the test target.

grunt test

To lint by hand, use the jshint target.

grunt jshint

To test in a browser environment, open frontend/SpecRunner.html.

Back-end

From within a virtual environment:

python run_tests.py

Lint via pep8.

pep8 mongows tests run*.py

More info

See the project wiki.

About

An interactive MongoDB shell in a web browser

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
license.sh

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published