Retirement of map-reduce in v2.x

My favorite thing about CBL is the native-function map-reduce. I’ve been trying to find an explanation for why it’s going away, or a discussion of it, but I’m coming up empty…probably just searching for the wrong thing. Is it just part of simplifying the API and maximizing performance?

  • It’s difficult for people to learn how to use map/reduce effectively. We get many, many newbie questions about it, in this forum and in Couchbase’s paid customer support.
  • Map/reduce is limited in what it can do compared to SQL, so complex queries have to be postprocessed (i.e. for sorting) or broken into multiple view queries that have to be combined by hand.
  • Calling the map function requires fully parsing the document and allocating an object tree, which is quite expensive, especially in garbage-collected runtimes like Java and .NET.
  • Couchbase Server has been moving away from map/reduce in favor of the N1QL query language for several years (for the same reasons above), and we want mobile to have a similar query mechanism.
3 Likes

Thanks for the explanation!

FYI . A preview of the N1QL like query API that Jens was mentioning
https://blog.couchbase.com/sql-for-json-query-interface-couchbase-mobile/

Give it a whirl and let us know what you think …

1 Like