-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On put, if you protect() every field, will wipe out entire collection #254
Comments
Found the solution, can't seem to submit a pull request. Under lib/resources/collection/index.js, around line ~520, wrap this:
with this:
|
A PR for this would be great. What was the issue when submitting one? |
It does not look like this problem is resolved (using 0.8.4). Small usecase where the object lost all values except from the id:
The collection has 3 fields: id (string), Name (string) and theArray (array). The onPut event handler protects 2 fields
|
* correct extreme uses of hide() and protect() this addresses the problem of #254 where, if you hide or protect all fields of an object during a PUT operation, all the data of the record will be deleted. * pass jshint requirement * Update index.js
I was adding protect() to a put method, to secure a collection. I started by adding all the fields and then backing out a few fields I wanted to change. I noticed when I had all the fields in put.js listed with protect(), it wiped out every row of data in that collection.
I have been testing it several times with all different field types (array, string, number, etc.) and seems to be consistent behavior.
I am going to dig for a solution, but wanted to give a heads up if someone else experienced this or already has a solution.
Check out: [Protect in the Deployd Docs](http://docs.deployd.com/docs/collections/adding-logic.md#s-On Put-3789)
The text was updated successfully, but these errors were encountered: