Change the “localhost:27017” portion to the host and port of your mongo server. For optimal performance, you should launch Precog on the same machine that is running the MongoDB server.
Precog will map the MongoDB databases and collections into the file system by placing the databases at the top level of the file system, and will nest the database collections under the databases (e.g. /mydb/mycollection/).
To tell Precog what the master account is, edit config.cfg and add the following settings:
The API key for the master account can be anything you like, but you should treat it securely because they whoever has it has full access to all of your MongoDB data.
You may also want to tweak the ports that Precog use for the web server that exposes the Precog REST API and to server labcoat:
Step 3: Launch Precog
To run precog.jar, you will need to install JRE 6 or later (many systems already have Java installed). If you’re on an OS X or Linux machine, just run the precog script, which automatically launches Java:
precog.sh
If you’re on a Windows machine, you can launch Precog with the precog.bat script.
Once Precog has been launched, it will start a web server that exposes the REST API as well as labcoat.
Step 4: Try the API
Once Precog is running, you have full access to the Precog REST API. You can find a large number of open source client libraries available on Github, and the Precog developers site contains a bunch of documentation and tutorials for interacting with the API.
Step 5: Try Labcoat
Labcoat is an HTML5 application that comes bundled in the download. You don’t have to use Labcoat, of course, since Precog has a REST API, but Labcoat is the best way to interactively explore your data and develop Quirrel queries.
The precog.jar comes with a bundled web server for labcoat, so once it’s running just point your browser at http://localhost:8000/ (or whatever port you’ve configured it for) and you’ll have a new labcoat IDE pointing at your local Precog REST API.
Step 6: Analyze Data!
Once you’ve got Labcoat running, you’re all set! You should see your MongoDB collections in the file system explorer, and you can query data from the collections, develop queries to analyze the data, and export queries as code that run against your Precog server.
Precog is a beta product, and Precog for MongoDB is hot off the press. You may encounter a few rough corners, and if so, we’d love to hear about them (just send an email to support@precog.com).
If you end up doing something cool with Precog for MongoDB, or if you just want to say hello, feel free to reach out to us via our website, or to me personally at john@precog.com.
Have fun analyzing!
John A. De Goes, CEO/Founder of Precog