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

query

#1

CB Community, SyncGateway, Couchbase Lite, Swift, iOS

Hey.

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?

Thanks


#2

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(Meta.id), SelectResult.all())


#3

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