Code Monkey home page Code Monkey logo

Comments (11)

aldeed avatar aldeed commented on May 21, 2024

Before I investigate more, which version of C2 are you using, and are you using collection-hooks package, too?

from meteor-collection2.

leroadrunner avatar leroadrunner commented on May 21, 2024

C2 change log indicate 0.2.17
I'm not using collection-hooks

from meteor-collection2.

aldeed avatar aldeed commented on May 21, 2024

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.

aldeed avatar aldeed commented on May 21, 2024

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.

leroadrunner avatar leroadrunner commented on May 21, 2024

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.

aramk avatar aramk commented on May 21, 2024

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.

eminaz avatar eminaz commented on May 21, 2024

@aldeed if I have [Object] or [String] as the type, how do I explicitly define the allowed properties for that object?

from meteor-collection2.

Firfi avatar Firfi commented on May 21, 2024

@eminaz would answer for @aldeed here: yourArray.$.yourProperty - see docs for examples

from meteor-collection2.

hassanjallow avatar hassanjallow commented on May 21, 2024

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.

aldeed avatar aldeed commented on May 21, 2024

@assutech Add blackbox: true to the Object field in the schema.

from meteor-collection2.

hassanjallow avatar hassanjallow commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.