Discussion:
CouchbaseLite 2.0: Writing complex queries
p***@decurtis.com
2018-06-20 14:51:00 UTC
Permalink
For the below query:
select * from myBucket where
((A = "value1" and B = "value2") or (A = "value2" and B = "value1"))
and (ARRAY_CONTAINS(C,"value1") == false or C is missing) and type =
"MyDocument" order by D desc limit 60;

Is it possible to convert the above N1QL query into CouchbaseLite 2.0's
Query object using select/from/where/order by expression?
Here 'A', 'B','C' and 'D' are properties of a document with type
"MyDocument"
Field A,B are of type string. C is an array fo type string and D is a date
field.

How we can nest expressions from above query to properly generate a where
clause in CouchbaseLite query?
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/b5bbaba5-35f5-4699-a36c-80da3b73f383%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jens Alfke
2018-06-20 22:59:43 UTC
Permalink
On Jun 20, 2018, at 7:51 AM, ***@decurtis.com<mailto:***@decurtis.com> wrote:

Is it possible to convert the above N1QL query into CouchbaseLite 2.0's Query object using select/from/where/order by expression?

Yes, although I don't have time to write out the source code.
What part is giving you trouble? Instead of the ARRAY_CONTAINS() function, use an "any
in
satisfies" expression.

—Jens
Privacy Policy<https://www.couchbase.com/privacy-policy> | Update Marketing Preferences<https://info.couchbase.com/unsubscribe-or-manage-preferences>
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/38BC35CB-26BA-44DD-8E97-097807792F85%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.
Loading...