sails.jswaterlinesails-mongo

how to set default value for a field in Sails models using Waterline ORM?


A very simple question but I am unable to find the answer to it. So in my Sails app I have a User model and I am trying to make a boolean field with a default value to be False.

Is there a way to specify defaults like some kind of default attribute etc??

I want something like this:

is_admin: {
        type: 'boolean',
        default: 'false'
    }

Thanks for your time.


Solution

  • use defaultsTo look this Waterline Docs