[SERVER-1787] incorrect results: map/reduce + query + index on an array Created: 13/Sep/10 Updated: 12/Jul/16 Resolved: 16/Jan/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.7.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ulrich Ahrendt | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 7 + mongodb 1.6.2 |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
I used the following collection and funtions (based on "MapReduce ----------------------------------- db.things.ensureIndex( {name:1, tags:1}); db.things.insert( { _id : 1, name : 'name1', tags : ['dog', 'cat'] } ); ); ); ); m = function(){ ); } ); r = function( key , values ){ ; res = db.runCommand( { mapreduce : 'things', map : m, reduce : r }); db[res.result].find(); ----------------------------------- Expected result: Function result: } } } OK! Now the same with a query: count only tags in doctumenmts with ----------------------------------- res = db.runCommand({ mapreduce : 'things', map : m, reduce : r, query: {name : 'name1'}}); db[res.result].find(); ----------------------------------- Expected result: Function result: } } Why that???? "count" always contains the total number of elements in the array } } } The reduce-function is called once for EACH element of the tags-array If I don't create the index "db.things.ensureIndex( {name:1, tags:1});" Ulrich http://groups.google.com/group/mongodb-user/browse_thread/thread/1f24161d3d1daf01 |
| Comments |
| Comment by auto [ 16/Jan/11 ] |
|
Author: {u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}Message: some mr tests for |
| Comment by Eliot Horowitz (Inactive) [ 16/Jan/11 ] |
|
was actually fixed earler, but not sure exactly when |