-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 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.
--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. 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.
mongod
instance, authentication is required for a client to access the HTTP status interface from another machine.
--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
db.$cmd.findOne({listDatabase:1})
on the admin
database in the shell:
http://localhost:28017/admin/$cmd/?filter_listDatabases=1&limit=1
http://host:port/db/$cmd/?filter_count=collection&limit=1
# 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.
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.
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
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.