I’m quite new with couchdb and I want to create a view based on a simple mysql statement.
I found this documentation: http://guide.couchdb.org/draft/cookbook.html but there are sadly not all use cases included.
My MySQL-Statement:
SELECT `title`, `id`, `author`, `date`, `text` FROM `news` WHERE `date`<=NOW() AND `author`='22' ORDER BY `date` DESC LIMIT 20,10;
Thank you very much!
You need to write a view with the following map function.
Now you can query the view using the following URL:
The date in the start key must be the current datetime. There is no way to emulate
NOW()in couchdb.A view in couchdb is just a list of key-value pairs sorted by key and it provides a way to access a range of that list. You need to design your view such that you can get the results that you need using a range query.