Socket
Book a DemoInstallSign in
Socket

mongo-restful

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-restful

A very simple MongoDB RESTful proxy

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

mongo-restful

A very simple RESTful MongoDB proxy.

Allows you to query a MongoDB database over HTTP:

MongoDB <--- HTTP --> Browser

Build Status

Limitations

Currencyly the API is read-only. Feel free to do a pull request :)

Installation

Install as a global binary:

npm install -g mongo-restful

Include into your own server:

npm install --save mongo-restful

CLI

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

Integration

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');
});

REST API

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:

  • q: The MongoDB query. Use MongoDB Extended JSON syntax, e.g. {"createdAt":{"$date":"2014-01-01T00:00:00Z"}}
  • filter: Optional projection, e.g. {"foo":1}
  • sort: Optional sorting object, e.g. {"bar":-1}
  • limit: Return only n results
  • skip: Skip n results

Request a specific document:

GET /my-collection/id

Note: It's expected that id is a MongoDB ObjectId.

License

MIT

FAQs

Package last updated on 19 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts