[SERVER-8805] aggregation $within command: exception thrown Created: 01/Mar/13  Updated: 08/Mar/13  Resolved: 01/Mar/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.4.0-rc1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Norberto Fernando Rocha Leite (Inactive) Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

QA


Issue Links:
Related
related to SERVER-6649 should aggregate shell helper throw o... Closed
Operating System: ALL
Steps To Reproduce:

run on shell the following command:

var single_value_box = [[1]];
var aggRes = col.aggregate( { $match: { loc: {$within: {$box: single_value_box}}}});

Participants:

 Description   

I believe this sticky code left for some js debugging:

collections.js

DBCollection.prototype.aggregate = function( ops ) {
    
    var arr = ops;
    
    if (!ops.length) {
        arr = [];
        for (var i=0; i<arguments.length; i++) {
            arr.push(arguments[i]);
        }
    }
 
    var res = this.runCommand("aggregate", {pipeline: arr});
    if (!res.ok) {
        printStackTrace();
        throw "aggregate failed: " + tojson(res);
    }
    return res;
}

redbeard0531 probably missed it:

git blame src/mongo/shell/collection.js | head -901 | tail -18
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  884) DBCollection.prototype.aggregate = function( ops ) {
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  885)     
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  886)     var arr = ops;
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  887)     
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  888)     if (!ops.length) {
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  889)         arr = [];
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  890)         for (var i=0; i<arguments.length; i++) {
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  891)             arr.push(arguments[i]);
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  892)         }
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  893)     }
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  894) 
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  895)     var res = this.runCommand("aggregate", {pipeline: arr});
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  896)     if (!res.ok) {
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  897)         printStackTrace();
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  898)         throw "aggregate failed: " + tojson(res);
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  899)     }
68f6dcd2 src/mongo/shell/collection.js (Mathias Stearn  2012-12-18 13:26:26 -0500  900)     return res;
5115bf67 shell/collection.js           (Eliot Horowitz  2011-12-09 04:20:54 -0500  901) } }
 

This should not throw an exception but an error message.

N.



 Comments   
Comment by Mathias Stearn [ 01/Mar/13 ]

I think this is WorksAsDesigned. See SERVER-6649. Is there anything else to this ticket or should I close it?

Comment by Norberto Fernando Rocha Leite (Inactive) [ 01/Mar/13 ]

Found running test script

Generated at Thu Feb 08 03:18:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.