1

I see below statement at When to use CouchDB over MongoDB and vice versa

For accumulating, occasionally changing data, on which pre-defined queries are to be run. Places where versioning is important.

I am not sure what predefined queries means here ?

scott miles
  • 1,511
  • 2
  • 21
  • 36

1 Answers1

3

It was referred to the view definition in CouchDB. The pre-defined queries are defined as map/reduced views that are indexed by CouchDB.

These views are defined in design documents stored in the database (pre-defined) By the time of the post you refer, it is based in the features of CouchDB 1.x, now in CouchDB 2.x you can use Mango Queries for dynamic query expressions.

Juanjo Rodriguez
  • 2,103
  • 8
  • 19
  • you mean to say that we can not fire dynamic queries from client(like java client). I believe views here you mean something like RDBMS view which are stored at DB side ? Are these views like materilized view in oracle (indexed views in sql server) ? – scott miles Jan 16 '18 at 15:01
  • 1
    You can run dynamic quieries by using _find endpoint and mango query expressions in CouchDB 2.x. Indexed materialized views could be a similar concept for CouchDB views. They are pre-calculated and stored in the db but the query over the view is restricted to the indexed key filtering. – Juanjo Rodriguez Jan 16 '18 at 15:28
  • 1
    One important difference to materialized views that is often overlooked: CouchDB views are incremental. So if you have 10 million documents in your database and add one document, only the view for this document has to be recalculated. This is also true for edits and deletes. Perfect for read-mostly scenarios like web apps. – Bernhard Gschwantner Jan 19 '18 at 01:31