-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Geo
-
None
When '{{num : { $in : [-1,NumberLong(-Infinity)] }}}', eg.
assert.throws( function() { t.runCommand('geoNear', {near: [50,50], num: -1}) }, {}, "num: -1" )
the following assertion is outputted
ue Jan 29 14:38:07.861 [conn2] test.geo2 Assertion failure numWanted >= 0 src/mongo/db/geo/2d.cpp 2384 0x106c34a8b 0x106c0e91c 0x106993e3e 0x1069a7b10 0x10678d9a5 0x10678e8e3 0x10678f195 0x106a3160e 0x106a31e11 0x1069dec7f 0x10665cb02 0x106c2a579 0x106c67145 0x7fff92d78742 0x7fff92d65181 0 mongod 0x0000000106c34a8b _ZN5mongo15printStackTraceERSo + 43 1 mongod 0x0000000106c0e91c _ZN5mongo12verifyFailedEPKcS1_j + 284 2 mongod 0x0000000106993e3e _ZN5mongo12run2DGeoNearERKNS_12IndexDetailsERNS_7BSONObjERSsRNS_14BSONObjBuilderE + 5518 3 mongod 0x00000001069a7b10 _ZN5mongo16Geo2dFindNearCmd3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 660 4 mongod 0x000000010678d9a5 _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 37 5 mongod 0x000000010678e8e3 _ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 2523 6 mongod 0x000000010678f195 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1013 7 mongod 0x0000000106a3160e _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 46 8 mongod 0x0000000106a31e11 _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1553 9 mongod 0x00000001069dec7f _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1519 10 mongod 0x000000010665cb02 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 198 11 mongod 0x0000000106c2a579 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1657 12 mongod 0x0000000106c67145 thread_proxy + 229 13 libsystem_c.dylib 0x00007fff92d78742 _pthread_start + 327 14 libsystem_c.dylib 0x00007fff92d65181 thread_start + 13
but assert.throws() does not catch any exception.
ssert: did not throw exception: num: -1 Error: Printing Stack Trace at printStackTrace (src/mongo/shell/utils.js:37:7) at doassert (src/mongo/shell/utils.js:58:1) at Function.assert.throws (src/mongo/shell/utils.js:204:1) at /Users/slee/Source/mongodb-src-r2.3.2/jstests/geo2.js:54:8 Tue Jan 29 14:38:07.868 javascript execution failed src/mongo/shell/utils.js:59 did not throw exception: num: -1 throw msg;
Also, the assertion should probably refer to the "num" argument instead of the underlying variable, 'numWanted'.