Generating unique Id using Ottoman node js


#1

I am using Ottoman to interact with Couch base in my application for Curd operations.

I have an document model like
User:{
username:‘string’,
_id:{type:‘string’, auto:‘uuid’, readonly:true},
phone:[{
phone_id:{type:‘string’, auto:‘uuid’, readonly:true},
phone_number:‘string’,
phone_type:‘string’
}]
}

When i try to create a document with this model Ottoman generates a UUID for the _id field but is not generating one for the internal phone_id field.

Two things I need inputs for.

  1. How can I generate an Id for this field.
  2. I will be deploying my node application on a cluster will this UUID remain unique around all instances on the cluster or there is a chance of two applications generating similar UUID for two insert request in exponentially heavy load scenario?

Thanks in advance for the inputs and guidance.