Search code examples
node.jssails.jswaterline

Sails.js Waterline Model Storage


I'm trying to store a large chunk of text as part of a model in Sails.js. However, it seems that the text is getting cut off after some length. Is there a limit set on how long the 'string' type can hold in a model? If so, what's the best way around it? For reference, I'm using sails-mysql as an adapter.


Solution

  • Yes, String is only 255 chars long on default (because thats the default length in the most databases).

    Try to use

    myfield: {
        type: "text"
    }
    

    As attribute - this should work.

    (See: http://beta.sailsjs.org/#/documentation/reference/Models/Attributes.html)