Search code examples
sails.jssails-mongosails-postgresql

Model Attribute Type: what is the difference between json and ref?


In the documentation regarding built-in data types, it is written:

json: Any JSON-serializable value, including numbers, booleans, strings, arrays, dictionaries (plain JavaScript objects), and null.

ref: Any JavaScript value except undefined. (Should only be used when taking advantage of adapter-specific behavior.)

I can't figure out the difference between them. When to use one instead of the other?


Solution

  • ref in conjunction with columnType can be used to represent native database data types, and use them, like binary data.

    Check the following link for more information

    https://sailsjs.com/documentation/concepts/models-and-orm/attributes#?columntype