Couchbase Lite equivalent of SQL's 'select * from some_table where some_column not in ('abc', 'def', 'xyz')

19 views
Skip to first unread message

Brendan Duddridge

unread,
Jul 11, 2015, 9:34:03 PM7/11/15
to mobile-c...@googlegroups.com
Is there any Couchbase equivalent to fetching a list of documents that are not contained within a specified list of documents? I'm thinking there's nothing, but it would be nice if there was a way to specify on a key by key basis in the CBLQuery keys property that some are inclusion values and some are exclusion values.

The scenario I have is a list of values displayed on screen with a button to let the user select from a list of available values. The list of available values would exclude all of the values that have already been selected by the user.

I'm thinking I'm just going to have to add a postFilter predicate to handle this sort of thing.

Thanks,

Brendan

Jens Alfke

unread,
Jul 12, 2015, 1:27:26 PM7/12/15
to mobile-c...@googlegroups.com
On Jul 11, 2015, at 6:34 PM, Brendan Duddridge <bren...@gmail.com> wrote:

Is there any Couchbase equivalent to fetching a list of documents that are not contained within a specified list of documents?

I’m not sure exactly what you mean, but I don’t think so. 

(Also, I have to nitpick and point out that queries don’t fetch documents, they fetch rows from the index, which are identified by keys. You can reach the source document via the row, but it’s not a one-to-one mapping (a document can emit multiple rows), and if you have a reduced or grouped query the rows are now created from multiple documents.)

I'm thinking there's nothing, but it would be nice if there was a way to specify on a key by key basis in the CBLQuery keys property that some are inclusion values and some are exclusion values.
… I'm thinking I'm just going to have to add a postFilter predicate to handle this sort of thing.

Yup, a postFilter is the way to do this. 

—Jens
Reply all
Reply to author
Forward
0 new messages