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

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

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())

2 Likes

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