0

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.

kk415kk
  • 1,227
  • 1
  • 14
  • 30

2 Answers2

2

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)

mdunisch
  • 3,627
  • 5
  • 25
  • 41
  • Hmmm... They don't show it in this table for some reason. http://sailsjs.org/documentation/concepts/models-and-orm/validations – Cody May 28 '16 at 19:16
  • That link is dead. Use this link as of lately. There's also longText and mediumText... http://sailsjs.org/documentation/concepts/models-and-orm/attributes – Cody May 28 '16 at 19:19
0

Try to use field: { type: 'ref' } this creates longtext in mysql .