documentID size limit?

12 views
Skip to first unread message

Brendan Duddridge

unread,
Oct 29, 2015, 8:15:07 PM10/29/15
to Couchbase Mobile
Hi,

Is there a size limit to the documentID? I know it's best to keep them small, but I may need to prefix them with a UUID to guarantee uniqueness.

Here's my situation. Due to legacy data the user may have acquired outside of my app, a user may have a record with ID "12345" in it. So when importing into my app, I use that as the documentID.

There are a couple of ways I'm thinking about handling this. One is to add a secondary key to my document "legacyID" or something like that and generating a UUID for the documentID. That means though that I have to keep track of a dictionary of legacyID to UUID mappings because I have all sorts of relationships that I manage during the import process. That's not too bad though.

The other thing I was thinking was just to prefix or append a UUID to the existing key. But sometimes the existing keys are pretty big themselves.

So that's why I was wondering if there was a limit to the key size.

Thanks,

Brendan


Jens Alfke

unread,
Oct 30, 2015, 1:24:44 PM10/30/15
to mobile-c...@googlegroups.com

On Oct 29, 2015, at 5:15 PM, Brendan Duddridge <bren...@gmail.com> wrote:

Is there a size limit to the documentID? I know it's best to keep them small, but I may need to prefix them with a UUID to guarantee uniqueness.

CBL doesn’t have a limit, but SG does, because Couchbase Server has a 255-byte limit on keys. So if you plan on being able to sync with SG, keep docIDs to under 255 UTF-8 bytes (not 255 characters — it’s more like 50-100 characters of non-Roman languages, for example.)

—Jens
Reply all
Reply to author
Forward
0 new messages