Skip to content
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

Set strategies seem all wrong... #341

Closed
j opened this issue Jun 28, 2012 · 1 comment
Closed

Set strategies seem all wrong... #341

j opened this issue Jun 28, 2012 · 1 comment

Comments

@j
Copy link
Contributor

j commented Jun 28, 2012

Aren't sets supposed to always overwrite a document's field? Maybe I don't know the internals of ODM too well, but $coll->getInsertDiff() is being executed. Also, when iterating over the insertDiff documents, the key starts at 1 (this isn't right in a collection that should be rewritten from scratch right?.. It makes sense for pushAll since we need to know the actual differences of the field being changed.

One other thing, when iterating over the documents, it doesn't check if the mapping is type = many...

The main problem I see is that collections are being inserted like,

{ $set : { 'documents.1.document2' : [ ... ] } }

when it should be

{ $set : { documents: [{ document: { ... } }, { document: { ... }] }

I can make a push with what I've done that is making set strategies work later.

We're supposed to go live with our product today... just delete functionality in embed-many documents is broken.

@jmikola
Copy link
Member

jmikola commented Feb 27, 2013

@j (heh, I just remembered you were awarded that short username): the insert/delete diff calculation compares keys and their values. The key shouldn't always start at 1, but you highlighted a caveat of using "set", where it might end up creating a BSON object instead of an array. I'm currently looking into this in #511.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants