MongoViewer 
MongoDB + Node.js + Express + D3
Install API Server CLI
MongoDB + Node.js + Express
npm install -g mongoviewer-server
Usage
Start your MongoViewer API Server:
mongoviewer-server
By default it will serve on port 8080: http://localhost:8080/.
See configuration options for customizing your API server.
Example customized:
mongoviewer-server --server:port 8081 --mongo:database testDb
See the API documentation for more details.
Developing MongoViewer
MongoDB + Node.js + Express + D3
Installation
npm install
bower install
Usage
node index.js
Configuration
Uses nconf.
See the default configuration file at default_config.json.
Alternatively you can use additional command line arguments:
--server:port 8080- Default8080.--server:CORS 1- Defaulttrue(1),falseis0.--mongo:port 27017- Default27017--mongo:database mongoviewer- Default ismongoviewer.
For example:
node index.js --server:port 8081 --mongo:database testDb
API
Version 1
/api/v1/
Find
See db.collection.find.
GET /api/v1/:collection/find
Query Parameters:
- query
- options
FindOne
GET /api/v1/:collection/findOne
Query Parameters:
- query
- options
Aggregate
GET /api/v1/:collection/aggregate
Query Parameters:
- pipeline
- options
Example API Usage
Load the example dataset, discreteData
node load.js
Load the example dataset, zips
From MongoDB example dataset: http://docs.mongodb.org/manual/tutorial/aggregation-zip-code-data-set/
mongoimport -db mongoviewer -c zips < example_data/zips.json
Start the Server
node index.js
This will start the server. Now you can view at http://localhost:8080/.
Example find API Query
Request: http://localhost:8080/api/v1/discreteBar/find?query={"label":"A Label"}
Response:
[
{
"label": "A Label",
"value": -29.765957771107,
"_id": "532e5294c1f6d3f17df677ba"
}
]
Example findOne API Query
Request: http://localhost:8080/api/v1/discreteBar/findOne?query={"label":"A Label"}
Response:
{
"label": "A Label",
"value": -29.765957771107,
"_id": "532e5294c1f6d3f17df677ba"
}
Example aggretate API Query
Request: http://localhost:8080/api/v1/discreteBar/aggregate?pipeline=[{"$match":{"label":"A Label"}}]
Response:
[
{
"label": "A Label",
"value": -29.765957771107,
"_id": "532e5294c1f6d3f17df677ba"
}
]


Log in or sign up for Devpost to join the conversation.