get

suspend fun get(id: String, common: CommonOptions = CommonOptions.Default, withExpiry: Boolean = false, project: List<String> = emptyList()): GetResult

Gets a document from this collection.

Parameters

id

The ID of the document to get.

withExpiry

As a performance optimization, the result does not include information about document expiry unless this parameter is set to true.

project

Prunes the returned JSON content, retaining only the elements rooted at the specified sub-document paths, as well as any intermediate parent elements required to preserve the document structure. A maximum of 16 paths can be projected at a time (15 if withExpiry is true). To work around this limitation, consider specifying shallower paths or fetching the whole document.

Throws

com.couchbase.client.core.error.DocumentNotFoundException

if a document with ID id is not found in the collection.