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

Using $set on a collection of nested documents #3

Merged
merged 2 commits into from May 21, 2011

Conversation

tonywok
Copy link

@tonywok tonywok commented May 21, 2011

Hey there,

First of all, thanks for making mongomatic!

While using it, I needed to update a document that was nested in the collection of a parent document. Anyway, I hacked in a little fix and included a test exposing the issue.

Oh, and I also added .rvmrc to the gitignore file so no one picked up my .rvmrc. Just ignore this if it's not your style :)

Something along the lines of this broke trying to convert a string into a fixnum:

@story.update({:'chapters.0.status' => 'complete'})

whereas, this worked in the interactive mongo shell

db.story.update({'_id' : some_id}, {$set : { 'chapters.0.status' : 'complete'}})

Thanks,
Tony Schneider
@tonywok

@jrwest
Copy link

jrwest commented May 21, 2011

I can recreate the bug by running:

@story.set('chapters.0.status', 'complete');

I think this was brought up a while back but no one provided a test case or a good solution. I think its good to merge.

jrwest added a commit that referenced this pull request May 21, 2011
Using $set on a collection of nested documents
@jrwest jrwest merged commit 4019e7b into jsmestad:master May 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants