0

I'm building a web app using Django and couchdb 2.0.

The new version of couchdb doesn't support temporary views. They recommend using a Mongo query but I couldn't find any useful documentation.

What is the best approach or library to use couchdb 2.0 with Django?

piet.t
  • 11,718
  • 21
  • 43
  • 52
abed maatalla
  • 31
  • 1
  • 9
  • This question is the type of "recommend"-question, that don't usually draw people attention. My best advice is to search for yourself, i'm quite sure that you ain't first one who faced with such problem. – vishes_shell Dec 25 '17 at 14:15
  • https://stackoverflow.com/questions/41086010/python-with-couchdb-2-0 i'm not the first but there is not answers.. there are not supported lib yet. tried a lot so far.. i come up to dead point. – abed maatalla Dec 25 '17 at 14:23
  • This is a tool/service/product recommendation (off-topic). Asking for "best approach or library" will only get you opinions and spam. If you have a specific question, then *great* - ask that. But as written, this is off-topic for StackOverflow. – David Makogon Dec 25 '17 at 15:00

1 Answers1

5

Temporary views were indeed abandoned in CouchDB 2.0. With mango, you could emulate them using a Hack, but that's just as bad (read: performance-wise). The recommendation is to actually use persistent views. As only the delta of new or updated documents need indexing, this will likely need significantly less resources.

As opposed to relational DBs, the created view (which is a persisted index by keys), is meant to be queried many times with different parameters (there is no such a thing as a query optimizer taking your temp view definition or something). So, when you're built heavily on temporary views, you might consider changing the way you query in the first place. One place to start is thinking about which attribute will collapse the result set most quickly to what you're looking for and build a view for that. Then, go query this view with keys and post-filter for the rest.

The closest thing you can do to a temporary view (when you really, really need it) is creating a design doc (e.g. _design/temp<uuid>) and use it for the one query execution.

Just to add a link (not new - but timeless) on the details: http://guide.couchdb.org/draft/views.html