Testing Ospriet

couch edited this page Apr 12, 2012 · 22 revisions

Start your local MongoDB database server

mongod --dbpath /path/to/data/db

You must do this before starting the application so that it can properly connect to the database.

Start your application

Start your application in development mode:

NODE_ENV=development node server.js

If you plan to actively edit the application though, using nodemon is recommended. nodemon monitors all of your app's files for changes and automatically restarts the server if any change is detected. Using nodemon:

NODE_ENV=development nodemon server.js

Once running, visit http://localhost:3000. You should see the site, and any @-replies to and favorites on your Twitter account posted while the app is running should automatically appear in the interface. At this point, you modify the views/templates as you see fit for your version of Ospriet.

Editing your MongoDB database from console

If you're having issues with favorites being stored, you may want to connect to the database, see what it contains and empty it if you need to 'reset' the database.


To start your local MongoDB interactive shell:


Your local database can have multiple collections, so once started, to see all collections:

show collections

To use Ospriet's favorites collection:

use favorites


To start your remote MongoDB interactive shell:

/usr/local/path/to/mongo -u nodejitsu -p XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX staff.mongohq.com:10040/nodejitsudbXXXXXXXXXXXX

where the path is the location of your Mongo install, and the Xs are the values given to you when you create a new database with jitsu.

Useful MongoDB methods

To see all the documents in your favorites collection on either instance:


If you'd like to empty the collection from testing:


☞ For more information on starting your database server, consult MongoDB's quickstart guide.

☞ To learn more about MongoDB methods, consult MongoDB's manual.

Next: Working with nodejitsu →