Flushing or Deleting a Collection
As part of the public interface, collections expose a collection name that is used to open a collection and an associated underlying collection id or CID that the client Leb128 encodes and appends to the first two bytes of the key (transparently). While the name is guaranteed to be unique for a given Bucket, Scope and Collection, the CID is auto generated internally by the server and can change for a given name if the collection is flushed or deleted. In order to support collections and changing CIDs, these steps must be followed:
The first time a collection name is encountered, the GET_ID command should be used to fetch the CID and cache it for reuse. If not found is returned, an error should be propagated to the user.
If the name is valid, continue along with the operation.
On future operations, the client should use the cached CID. If an error is returned by the server indicating that the CID is invalid, a GET_ID should be executed and the new CID retrieved and cached along with the operation being resent. Note that other collections should NOT be invalidated by this GET_ID call, as they are likely to still be accurate.
If an error occurs, the client should propagate and error message to the user indicating that collection cannot be found.
https://docs.couchbase.com/server/6.5/developer-preview/collections/manage-collections-with-rest.html
https://docs.couchbase.com/server/6.5/developer-preview/collections/manage-collections-with-cli.html
Putting back into back log pending more discovery.