Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/definition-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ There are a set of options to control the model definition.

- strict:
- true: Only properties defined in the model are accepted. Use this
mode if you want to make sure only predefined properties are accepted.
mode if you want to make sure only predefined properties are accepted. Relational databases only support this setting.
Comment thread
agnes512 marked this conversation as resolved.
- false: The model will be an open model. All properties are accepted,
including the ones that not predefined with the model. This mode is useful
if the mobile application just wants to store free form JSON data to
a schema-less database such as MongoDB.
a schema-less database such as MongoDB. For relational databases, the value will be converted back to true.
- undefined: Default to false unless the data source is backed by a
relational database such as Oracle or MySQL.

Expand Down
4 changes: 3 additions & 1 deletion lib/datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,9 @@ DataSource.prototype.define = function defineClass(className, properties, settin
settings.strict = true;
}
if (settings.strict === false) {
settings.strict = 'throw';
console.warn("WARNING: relational database doesn't support {strict: false} mode." +
` {strict: true} mode will be set for model ${className} instead.`);
settings.strict = true;
}
}

Expand Down