[CSHARP-472] MapReduce fails with options SetQuery, SetSortOrder Created: 20/May/12 Updated: 20/Mar/14 Resolved: 22/May/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Roman Kuzmin | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
The attached Program.cs fails with the message: Message=Command 'mapreduce' failed: db assertion failure (response: { "assertion" : "could not create cursor over test.test for query : { B: { $exists: true }} sort : { B: 1 }", "assertionCode" : 15876, "errmsg" : "db assertion failure", "ok" : 0.0 }) The code is based on the official test TestMapReduceInlineWithQuery. Perhaps var result = _collection.MapReduce(query, map, reduce); is replaced with var options = new MapReduceOptionsBuilder(); If I remove the line with SetSortOrder then the code works fine. Sorry if I just do something wrong and this is a false alarm. I asked the |
| Comments |
| Comment by Robert Stam [ 11/Jun/12 ] |
|
In what way does it not work? The best thing you could do is create a sample of what you mean using the mongo shell and file a server ticket. |
| Comment by Nikolay Imshenitsky [ 11/Jun/12 ] |
|
It removes the error but sorting still doesn't work. |
| Comment by Roman Kuzmin [ 22/May/12 ] |
|
Yes, it works for me. It is still an issue, MR or its documentation. But it has nothing to do with C# driver, of course. Thank you for taking a look at this. |
| Comment by Robert Stam [ 22/May/12 ] |
|
Looks like the server requires the existence of an appropriate index that it can use for the sort when using sort with map/reduce. Try defining this index: > db.test.createIndex( {B:1}) and then it should work. |
| Comment by Roman Kuzmin [ 21/May/12 ] |
|
I've tried this in the shell (after running my app, so that the test.test collection exists). It fails with the same error message. It does not fail if I remove the line with 'sort'. JS code: map = function() { ) reduce = function(key, emits) { return {count : total}} db.runCommand( , }, } |
| Comment by Robert Stam [ 21/May/12 ] |
|
Sorry, I missed your point that the existing unit tests could be modified to give the same error. Will try that in the morning (and/or use your attached program). Thanks. |
| Comment by Roman Kuzmin [ 21/May/12 ] |
|
Robert, I will try this in the shell as soon as I can (I'm very lame in the shell, btw). As for the request for more information, the attached program has it all, it creates all that it needs. Also, you can use the existing test TestMapReduceInlineWithQuery and replace one line as I suggested. |
| Comment by Robert Stam [ 21/May/12 ] |
|
Two requests: 1. Can you try the same map/reduce in the mongo shell to see if the C# driver has anything to do with this Thanks. |
| Comment by Robert Stam [ 21/May/12 ] |
|
I assume the corresponding question on Google Groups is: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/SwULp7Y6oSY |