sails.jswaterline

Using Array Attribute Type in Sails


I'm looking to use the sails attribute type 'array' in my app, but I can't find documentation for this anywhere.

I'd like to do the following:

module.exports = {
 attributes : {
  images: {
   type: ['string']
  },
  location: {
   type: ['float','float']
  }
 }
}

image is an array that will hold a list of image urls and location will hold 2 floats. Will this work in sail's? Else how can I get this to work. Thanks

PS: I'm working solely with MongoDB


Solution

  • As far as I know, you can only specify it like this:

    module.exports = {
        attributes : {
            images: {
                type: 'array'
            },
            location: {
                type: 'array'
            }
        }
    }
    

    See Sails ORM Attributes