[SERVER-1247] comparing ObjectId equality fails in map_reduce Created: 17/Jun/10 Updated: 12/Jul/16 Resolved: 23/Jun/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Richard Shea | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
pymongo 1.6, MongoDB 1.4.3. Single server, Ubuntu 9.10. |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
I had a case where I wanted to compare ObjectId instances as part of a map_reduce and it was failing because checking for equality on two ObjectId instances that should have been the same aren't detected as being the same. Sample Python program (showing nothing was emit()'ed from map function, even though there should have been: MAP = """ } " dbc=pymongo.Connection(); db=dbc.test oids = [] c1 = db.entries_with_ids )) )) c2 = db.mr_test ) c3 = c2.map_reduce(pymongo.code.Code(MAP), pymongo.code.Code(RED)) print c2.find_one() Sample output: {u'single': ObjectId('4c1a478603eba73620000000'), u'_id': ObjectId('4c1a478603eba73620000002'), u'all': [ObjectId('4c1a478603eba73620000000'), ObjectId('4c1a478603eba73620000001')]}result size 0 |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 23/Jun/10 ] |
|
You can't overload == in js, but I did add a .equals method which should work. |
| Comment by auto [ 23/Jun/10 ] |
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: ObejctId.equals |