kk415kk
kk415kk

Reputation: 1247

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.

Upvotes: 0

Views: 908

Answers (2)

Sona Israyelyan
Sona Israyelyan

Reputation: 39

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

Upvotes: 0

mdunisch
mdunisch

Reputation: 3697

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)

Upvotes: 2

Related Questions