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

MIM: Incorrect positional $ behavior sometimes #26

Open
brondsem opened this issue Jun 18, 2020 · 0 comments
Open

MIM: Incorrect positional $ behavior sometimes #26

brondsem opened this issue Jun 18, 2020 · 0 comments

Comments

@brondsem
Copy link
Collaborator

While working on the fix of #25, I found that sometimes the wrong behavior occurs. On branch mim_dot_dollar_wrong this is illustrated by test_inc_dotted_dollar_middle2 with a $ in the middle of dotted field notation, and selecting for the 2nd subdoc in the list:

Ming/ming/tests/test_mim.py

Lines 213 to 217 in 256f2b1

def test_inc_dotted_dollar_middle2(self):
# match on g=2 and $inc by 10
self.coll.update({'b.f.g': 2}, { '$inc': { 'b.f.$.g': 10 } })
obj = self.coll.find_one({}, { '_id': 0, 'b.f': 1 })
self.assertEqual(obj, { 'b': { 'f': [ { 'g': 1 }, { 'g': 12 } ] }})

AssertionError: {'b': {'f': [{'g': 11}, {'g': 2}]}} != {'b': {'f': [{'g': 1}, {'g': 12}]}}
- {'b': {'f': [{'g': 11}, {'g': 2}]}}
?                    -

+ {'b': {'f': [{'g': 1}, {'g': 12}]}}
?

That branch has expanded tests where the $ is at the end of dotted field notation, and they do all pass.

I haven't looked into this any further, seems kinda tricky. And not actually a blocking problem for me right now.

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

1 participant