REST InterfacesSleepy Mongoose (Python)Sleepy Mongoose is a full featured REST interface for MongoDB which is available as a separate project. MongoDB Rest (Node.js)MongoDB Rest is an alpha REST interface to MongoDB, which uses the MongoDB Node Native driver. HTTP ConsoleMongoDB provides a simple http interface listing information of interest to administrators. This interface may be accessed at the port with numeric value 1000 more than the configured mongod port; the default port for the http interface is 28017. To access the http interface an administrator may, for example, point a browser to http://localhost:28017 if mongod is running with the default port on the local machine.
Here is a description of the informational elements of the http interface:
HTTP Console SecurityIf security is configured for a mongod instance, authentication is required for a client to access the http interface from another machine. Simple REST InterfaceThe mongod process includes a simple read-only (no support for insert/update/remove) REST interface for convenience. For full REST capabilities we recommend using an external tool such as Sleepy.Mongoose. v1.4+: This interface is disabled by default. Use --rest on the command line to enable. To get the contents of a collection (note the trailing slash): http://127.0.0.1:28017/databaseName/collectionName/
To add a limit: http://127.0.0.1:28017/databaseName/collectionName/?limit=-10
To skip: http://127.0.0.1:28017/databaseName/collectionName/?skip=5
To query for {a : 1}: http://127.0.0.1:28017/databaseName/collectionName/?filter_a=1
Separate conditions with an &: http://127.0.0.1:28017/databaseName/collectionName/?filter_a=1&limit=-10
Same as db.$cmd.findOne({listDatabase:1}) on the "admin" database in the shell: http://localhost:28017/admin/$cmd/?filter_listDatabases=1&limit=1
To count documents in a collection: http://host:port/db/$cmd/?filter_count=collection&limit=1
JSON in the simple REST interfaceThe simple ReST interface uses strict JSON (as opposed to the shell, which uses Dates, regular expressions, etc.). To display non-JSON types, the web interface wraps them in objects and uses the key for the type. For example: # ObjectIds just become strings "_id" : "4a8acf6e7fbadc242de5b4f3" # dates "date" : { "$date" : 1250609897802 } # regular expressions "match" : { "$regex" : "foo", "$options" : "ig" } The code type has not been implemented yet and causes the DB to crash if you try to display it in the browser. See Mongo Extended JSON for details. See Also |


PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.
blog comments powered by Disqus