Feature: Mango Query

This is the fourth in a series of blog posts introducing the Apache CouchDB 2.0 release. Read parts one, two, and three in the series. 

Two years ago, Cloudant developed a declarative style syntax for creating and querying Cloudant indexes. The idea was to attract users who were not familiar with Map-Reduce and Javascript but still wanted to experience the power of NOSQL databases. Moreover, the syntax was MongoDB-inspired, meaning that users already familiar with MongoDB’s find() operator could easily transition over to Cloudant’s new declarative API. Cloudant introduced this feature as Cloudant Query. Within a few months, Cloudant donated Cloudant Query to CouchDB. We decided to adopt the development codename for introduction to the CouchDB community. Lo and behold: Mango.

For a quick introduction on how to get started with creating and querying indexes using Mango, check out this informative post: Introducing Cloudant Query.

When Mango was first donated to CouchDB, the codebases were identical. However, the repositories diverged as Cloudant added a new text-search feature to Cloudant Query that leveraged Cloudant’s existing full-text-search API. The new text-search feature also made the existing query API more flexible and truly ad-hoc. At the time, Cloudant’s full-text-search was not open sourced, and thus CouchDB’s version could not reap the benefits.

In late July of 2015, Cloudant open sourced full-text-search. This allowed Cloudant Query and Mango Query to become synchronized.

Check out Enable Full Text Search in Apache CouchDB to start using text search with Mango Query.

To fully understand the differences between original Mango JSON indexes and text indexes checkout Mango JSON vs Text Indexes. One of the restrictions of Mango in the past two years was that users had to create an index first before running a query. This was a nuisance to developers who just wanted to execute a query against the database, especially when they encountered the infamous no_index_found error. We’re happy to announce that in CouchDB 2.0, this restriction has been lifted. Users can now execute queries without the need to create an index first.

 

Tony Sun is a software developer at IBM Cloudant focusing on indexing and core API functionality. He is also a CouchDB committer.


You can download the latest release candidate from http://couchdb.apache.org/release-candidate/2.0/. Files with -RC in their name a special release candidate tags, and the files with the git hash in their name are builds off of every commit to CouchDB master.

We are inviting the community to thoroughly test their applications with CouchDB 2.0 release candidates. See the testing and setup instructions for more details.