A very simple MongoDB RESTful proxy
MIT License
A very simple RESTful MongoDB proxy.
Allows you to query a MongoDB database over HTTP:
MongoDB <--- HTTP --> Browser
Currencyly the API is read-only. Feel free to do a pull request :)
Install as a global binary:
npm install -g mongo-restful
Include into your own server:
npm install --save mongo-restful
Just run the following command:
mongo-restful [options] [arguments]
Specify the MongoDB URI as the first argument to the mongo-restful command.
Options:
--port
- specify which port the HTTP server should run on (defaults to 8080)Example:
mongo-restful --port 3000 localhost/my-database
You can also integrate mongo-restful into your exsiting node project:
var mongoUri = 'localhost/my-database';
var proxy = require('mongo-restful')(mongoUri);
proxy.listen(8080, function () {
console.log('The MongoDB proxy is running on port 8080');
});
Query a collection:
GET /my-collection?q=...
Use query parameters to filter your query. All query parameters are optional, but if none are given the entire collection is retuned!
Query parameters:
{"createdAt":{"$date":"2014-01-01T00:00:00Z"}}
{"foo":1}
{"bar":-1}
Request a specific document:
GET /my-collection/id
Note: It's expected that id
is a MongoDB ObjectId.
MIT