encode couchbase queries