MongoDB Interface

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

REST Interfaces

Eve (Python)

Eve is an open-source Python REST API framework designed for human beings. It allows us to effortlessly build and deploy highly customizable, fully featured RESTful Web Services powered by MongoDB. The codebase is thoroughly tested under Python 2.6, 2.7, 3.3, 3.4, and PyPy. All you need to bring your REST Web Service online is a MongoDB database, a configuration file, and a launch script. Overall, you will find that configuring and fine-tuning your API is a very simple process.

-Emphasis on REST

-Full range of CRUD operations

-Customizable resource endpoints

-Customizable, multiple item endpoints

-Filtering and Sorting

-Pagination

-HATEOAS

-JSON and XML Rendering

-Conditional Requests

-Data Integrity and Concurrency Control

-Bulk Inserts

-Data Validation

-Extensible Data Validation

-Resource-level Cache-Control

-API Versioning

-Document Versioning

-Authentication

RESTHeart (Java)

RESTHeart Java REST API server for MongoDB, built on top of Undertow non-blocking HTTP server. License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3.

-CRUD operations API on your data;

-Data model operations API: create databases, collections, indexes, and the data structure;

-Super easy setup, with convention over configuration approach;

-Pluggable security with User Management and ACL;

-HAL hypermedia type;

-Super lightweight: pipeline architecture, ~6Mb footprint, ~200Mb RAM peak usage, starts in milliseconds;

-High throughput: very small overhead on MongoDB performance;

-Horizontally scalable: fully stateless architecture supporting MongoDB replica sets and shards;

-Built on top of Undertow non-blocking HTTP server;

-Embeds the excellent HAL browser by Mike Kelly (the author of the HAL specifications);

-Supports Cross-Origin Resource Sharing (CORS) so that your one-page web application can deal with RESTHeart running on a different domain. In other words, CORS is an evolution of JSONP;

-Ideal as AngularJS (or any other MVW Javascript framework) back-end.

DrowsyDromedary (Ruby)

DrowsyDromedary is a REST layer for MongoDB based on Ruby.

Crest (Node.jS)

The crest is a REST API Server for MongoDB built-in node.js using the MongoDB Node Native driver.

AMID

AMID is a REST interface for MongoDB. Written in Node.js, supports multi-threading and a modular architecture to perform the custom search operation. AMID also provides an optional extjs GUI for queries:AMIDGUI.

Mongodb Java REST server

MongoDB Java REST server based on Jetty.

Kule

Kule is a customizable REST interface for MongoDB based on Python.

DreamFactory

DreamFactory is an open source backend with a REST API for MongoDB. DreamFactory on GitHub.

HTTP Interfaces

Sleepy Mongoose (Python)

Sleepy Mongoose is a full featured HTTP interface for MongoDB.

HTTP Status Interface

Deprecated since version 3.2: Starting in 3.2, MongoDB deprecates the HTTP interface.
MongoDB provides a simple HTTP interface listing information of interest to administrators. If you enable the interface with the --rest option to mongod you may access it via a port that is 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. Capture.588 Here is a description of the informational elements of the HTTP interface:
element description
db version database version information
git hash database version developer tag
sys info mongod compilation environment
dblocked indicates whether the primary mongod mutex is held
uptime time since this mongod instance was started
assertions any software assertions that have been raised by this mongod instance
replInfo information about replication configuration
currentOp most recent client request
# databases number of databases that have been accessed by this mongod instance
curclient last database accessed by this mongod instance
Cursors describes outstanding client cursors
master whether this mongod instance has been designated a master
slave whether this mongod instance has been designated a slave
initialSyncCompleted whether this slave or repl pair node has completed an initial clone of the mongod instance it is replicating
DBTOP Displays the total time themongod instance has devoted to each listed collection, as well as the percentage of available time devoted to each listed collection recently and the number of reads, writes, and total calls made recently
dt Timing information about the primary mongod mutex
These core tutorials will help you to learn the fundamentals of Mongo DB.
For an in-depth understanding and practical experience, explore Online Mongo DB Training.

HTTP Status Interface Security

If security is configured for a mongod instance, authentication is required for a client to access the HTTP status interface from another machine.

Simple REST API

The mongod process includes a simple REST API as a convenience. With no support for insert, update, or remove operations, it is generally used for monitoring, alert scripts, and administrative tasks. For full REST capabilities, consider using an external RESET interface  such as Sleepy.Mongoose. v1.4+: This API is disabled by default, as it could provide unauthenticated access to data. Use --rest on the command line to enable, but be aware of security implications. 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 API

The simple REST API 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.

Replica Set Admin UI

The mongod the process includes a simple administrative UI for checking the status of a replica set. To use, first enable --rest from the mongod command line. The rest port is the db port plus 1000 (thus, the default is 28017). Be sure this port is secure before enabling this. Then you can navigate to http://<hostname>:28017/ in your web browser. Once there, click Replica Set Status (/_replSet) to move to the Replica Set Status page. Capture.591

 

 

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox