Duplicate meta().ID

I have an app that uses couchbase lite to generate many documents. This app periodically uploads these documents via PHP where they are inserted to a couchbase server.

This means when a document is created in couchbase lite, it is unaware of any possibility that document ID has been used on the server or on another client. These devices spend most their time offline, and periodically connect to wifi to upload the documents.

How are document IDs guaranteed to be unique? Would it be best to generate my own document ID that uses profile information (such as my own UUID) to generate DocIDs. Like Meta().ID = uuid + timestamp + random number

I understand in a scenario where I used the sync gateway this would never come up, I am assuming because of communication between the server and clients.

Thank you for any information!

The Java CBLite library uses, exactly, Java’s UUID.randomUUID() to generate IDs (other platforms do something equivalent). That’s pretty safe.

If you happen to be struck by lightening several times in the same week, you might have to worry. Otherwise, they are probably ok.