Using SailsJS, I'm trying to figure out how to use a custom Primary Key as Integer that auto increments.
For that, I passed autoPK:false
, but I see that mongo still used it's 'id' field with UUID, as if Waterline is ignoring my autoPK entry.
For example, I define this model (configured for mongodb)
module.exports = {
autoPK: false,
attributes: {
name:'string',
personalId: {
type: 'integer',
autoIncrement:true,
primaryKey: true
}
}
}
Here's an output from sails console
:
sails> User.create({name:'Mike'}).exec(console.log)
undefined
sails> null { name: 'Mike',
createdAt: Fri Mar 27 2015 22:11:51 GMT+0300 (IDT),
updatedAt: Fri Mar 27 2015 22:11:51 GMT+0300 (IDT),
id: '5515ab77ac1085260b221cfd' }
I would expect to see personalId:1
or something like that instead of id:'5515ab77ac1085260b221cfd'
.
Thanks.