In this article, we have covered a possible approach to integrate Boomi Atomsphere with MongoDB using RESTHeart service. RESTHeart provides a REST interface to interact with MongoDB using JSON over HTTP.
MongoDB is one of the most prominent NoSQL databases. It works on the concept of documents and collections. A document is a set of key-value pairs. MongoDB’s documents are encoded in a JSON-like format, called BSON (binary JSON). A collection is a group of MongoDB documents. More details can be found on MongoDB’s website.
While there are number of interfaces and tools available for integrating with MongoDB, we will be using the RESTHeart API because it provides a lightweight REST interface, easy setup, and high performance. The RESTHeart API enables CRUD operations on MongoDB’s document and collections. With AtomSphere’s HTTP Connector it’s easy to model the CRUD methods provided by the API.
Installation and Prerequisites
This example requires following setup related activities:
RESTHeart API Tutorial and API Reference
For this POC, I already created a database (dev) and a collection (employees) in MongoDB which would be used to create and query documents from Boomi process
creates or updates a document in the collection of the db
- POST has upsert semantic: if the document exists it will be updated, otherwise it will be created.
- The document id can be specified with the optional property _id; otherwise an _id will be created
- Optimistic concurrency control via ETag (entity tag) is required.
For updates, it’s mandatory to provide ETag (https://softinstigate.atlassian.net/wiki/display/RH/ETag) in a HTTP header If-Match. If not passed, server returns HTTP 409 with ETag in the header for the conflicting document.
JSON Profile for the Object:
Branch 1 attempts to insert a document. If there is a conflict (HTTP 409 response), then it saves ETag and use it in Branch 2 for Update
This returns the HAL representation of the collection of db with its documents as embedded resources
- Paging supported.
- Sorting supported.
- Filtering supported.
- ETag based caching supported (entity tag).
- Eager db cursors preallocation supported. Dramatically improves read performances on big collections.
Note – Before Sending to connector filter in the URI should be encoded (http://www.w3schools.com/jsref/jsref_encodeURI.asp)
Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/yIugZvtNNl0/DOC-2421