tags:

views:

70

answers:

2

As part of my application requirements, I have a limit of 30 characters for an ID field. This is out of my control and I am wondering if the MongoDB default _id fields will work for me. It appears as though the default _id field is 24 characters long. That works for me, but I am wondering if this is likely to change in the future. I am well aware that things can always change, but, for the next year or two, can I expect there to be 24 character default _id fields?

+1  A: 

They aren't actually 24 characters - they are 12 bytes (24 characters in hex representation). And yes, that will be the case for the foreseeable future.

mdirolf
A: 

You could generate IDs yourself to be on the safe side.

Fionn