What happens when startKey and endKey are same in a grouped query?

14 views
Skip to first unread message

parvez....@decurtis.com

unread,
Mar 19, 2018, 9:26:26 AM3/19/18
to Couchbase Mobile
For a Couchbase lite ios application using version 1.4.1 if one specify same value for both startKey and endKey (both being array) along with non zero group level then how the query will work in such cases? I want to understand the behaviour of query in such cases so if anybody can elaborate a little over this, it will be helpful.

Thanks

Jens Alfke

unread,
Mar 20, 2018, 4:49:03 PM3/20/18
to mobile-c...@googlegroups.com


On Mar 19, 2018, at 6:26 AM, parvez....@decurtis.com wrote:

For a Couchbase lite ios application using version 1.4.1 if one specify same value for both startKey and endKey (both being array) along with non zero group level then how the query will work in such cases?

You'll get all of the rows with that exact key.
Since the keys are all identical, grouping will have no effect.

—Jens

parvez....@decurtis.com

unread,
Mar 23, 2018, 10:12:56 AM3/23/18
to Couchbase Mobile
For an emit with multiple keys as Array [Key0,Key1,Key2], is it possible to specify startKey/endKey with multiple matches separated by Or like the where clause in SQL query separated by Or keyword like this startKey = ["Key1Tomatch" or "Key2Tomatch"]

On Wednesday, March 21, 2018 at 2:19:03 AM UTC+5:30, Jens Alfke wrote:

Jens Alfke

unread,
Mar 24, 2018, 5:18:56 PM3/24/18
to mobile-c...@googlegroups.com


On Mar 23, 2018, at 7:12 AM, parvez....@decurtis.com wrote:

For an emit with multiple keys as Array [Key0,Key1,Key2], is it possible to specify startKey/endKey with multiple matches separated by Or like the where clause in SQL query separated by Or keyword like this startKey = ["Key1Tomatch" or "Key2Tomatch”]

Can you be more clear? I don’t know what multiple startKeys would mean. How can it start in two different places at once?

You can set the query’s Keys property to retrieve all the rows with multiple keys. But you can’t do ranges that way. You can only get one range per query.

—Jens

Jens Alfke — Mobile Architect — Couchbase, Inc.

Reply all
Reply to author
Forward
0 new messages