Move the WHERE statement outside of the build clause function so its not added on nested calls.
Working on couchdb read with generated map functions