How to .select(SelectResult.all()) AND return document doc ID's?

CB Community, SyncGateway, Couchbase Lite, Swift, iOS


I am completing a query and using .select(SelectResult.all()) but I would also like the return the document id’s. It seems this method only returns document data, it does not return any document meta data.

Is there a way to also return these values?


The document ID is part of the document’s meta data. Using SelectResult.all() will return the content of the document, not meta data. You can do the following to get the document ID.

select(SelectResult.expression(, SelectResult.all())


Thanks. I didn’t realise you could combine the ‘’’.select’’’ parameters.