Comments (11)
Before I investigate more, which version of C2 are you using, and are you using collection-hooks package, too?
from meteor-collection2.
C2 change log indicate 0.2.17
I'm not using collection-hooks
from meteor-collection2.
Is there more to your schema? When you do Object
or [Object]
as the type, you need to explicitly define the allowed properties for that object. It can't be a "black box", or validation should fail. I don't see definitions for itemSubCategories.$.pictures.$.name
or itemSubCategories.$.pictures.$.position
, so I would expect this to fail on both client and server.
I don't think we have tests written for more than 1 level deep of object arrays, though, so maybe there is a bug. I'll have to do some testing.
from meteor-collection2.
I added tests for deeper nesting such as this in the simple-schema
package, and they all pass. So there's nothing wrong with the validation, but possibly the C2 layer is messing up something.
Upgrading to collection2 0.3.3 might help. A bunch of the logic is rewritten. It should be backwards compatible with your 0.2.17 code, except for deprecation of support for Offline.Collection and SmartCollection, if you use those.
from meteor-collection2.
Thanks a lot. I'll try soon this solution, but I'll have to git the project back where I had this issue. In fact I rewrite all the logic and deport the "pictures" in another collection to make the data less deep.
from meteor-collection2.
Using this code gave me the following error:
Entities.update(entityId, {$set: {}});
Error: When the modifier option is true, validation object must have at least one operator
Changing it to prevent validation prevented the error:
Entities.update(entityId, {$set: {}}, {validate: false});
from meteor-collection2.
@aldeed if I have [Object] or [String] as the type, how do I explicitly define the allowed properties for that object?
from meteor-collection2.
@eminaz would answer for @aldeed here: yourArray.$.yourProperty
- see docs for examples
from meteor-collection2.
Is there anyway to set type to Object and just pass any object without defining properties for that object? In case for instance where the keys are dynamic.
from meteor-collection2.
@assutech Add blackbox: true
to the Object
field in the schema.
from meteor-collection2.
Worked like a cham, thanks. :)
Sent from my iPod
On Aug 30, 2015, at 10:57 AM, Eric Dobbertin [email protected] wrote:
@assutech Add blackbox: true to the Object field in the schema.
—
Reply to this email directly or view it on GitHub.
from meteor-collection2.
Related Issues (20)
- [3.0.3] Upsert fails even if document inserted would match the schema definition HOT 2
- Using $pop to remove an array item causes an error HOT 2
- Using the all positional operator $[] in nested arrays causes an error HOT 4
- Upsert no longer works in 3.0.5
- Duplicate key errors not correctly reporting (no Meteor.Error) HOT 3
- Migration from Meteor 1.4 to 1.9, Collection 2 from 2.10 to 3.0, SimpleSchema with meteor-collection2 error on unique option HOT 3
- Can't update the collection HOT 3
- Dynamic Schema with Validation HOT 10
- Is it possible to create field type that takes key and value pair? HOT 4
- Writing a robust updatedAt autoValue HOT 4
- CONTRIBUTING.md is missing HOT 1
- Breaking change in v3.2.0 for extending schemas HOT 2
- Delete the name of collections in error messages HOT 5
- Question: A way to log all errors without actually throwing them? HOT 1
- Does not work with `$[]` positional operator HOT 1
- relplace lodash with underscore HOT 3
- FLE-Encryption HOT 3
- Expose defaultCleanOptions HOT 10
- Apply `defaultValue` on `fetch` HOT 6
- Stub exceptions are logged instead of thrown in Meteor Methods, preventing throwStubExceptions from working as intended
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-collection2.