balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.84k stars 1.95k forks source link

How can not-defined attributes(arbitrary data) be allowed? #7249

Open anselmo-coolstay opened 2 years ago

anselmo-coolstay commented 2 years ago

Node version: 16.16.0 Sails version (sails): 1.5.2 ORM hook version (sails-hook-orm): 4.0.1 Sockets hook version (sails-hook-sockets): 2.0.1 Organics hook version (sails-hook-organics): Not used Grunt hook version (sails-hook-grunt): 5.0.0 Uploads hook version (sails-hook-uploads): Not used DB adapter & version (e.g. sails-mysql@5.55.5): Not used Skipper adapter & version (e.g. skipper-s3@5.55.5): Not used


Hi. I'm using MongoDB and sails-mongo v2.0.0.

According to https://sailsjs.com/documentation/concepts/models-and-orm/model-settings#?schema, not-defined attribute(arbitrary data) can be allowed if config.models.schema is set to false. But, I failed to do that with the below message when creating a record to a model:

WARNING: Automatically trimmed extraneous values!
In call to addMyModel(), 1 of the provided values (notDefinedAttribute) does not correspond with any recognized input.
Please try again without the extra value, or check your usage and adjust accordingly.

In addition, controllers also remove not-defined attributes when it is called thru routes.

How can I allow it?

sailsbot commented 2 years ago

@anselmo-coolstay Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.