Is it possible to insert a new document into a Couchbase bucket without specifying the document’s ID? I would like use Couchbase’s Java SDK create a document and have Couchbase determine the document’s UUID with Groovy code similar to the following:
Thank you, @simonbasle. Do you know how Couchbase developers typically go about create their documents’ IDs? I am dealing with a difficult data set where it is not the case that each entry will always have an inherently unique value. For example, it is not the case that each entry will always have a unique ID from another system (e.g. an SSN, an e-mail address, etc).
@gmina That is a great idea. Let me try to implement it. Calling UUID.randomUUID().toString() returns an object of type java.util.UUID. But I will see if Couchbase accepts the value as a document ID.
Using the UUID without the toString() method seems to be working. (I am storing the value to a String variable instead.) Hopefully, I am not overlooking anything that will come back to bite me later on.