Permalink
Browse files

put cursor used in distinct stats output

  • Loading branch information...
1 parent b49e933 commit d2bb5fa4f3145c57fb76cc39a7c742ca82347810 @erh erh committed Mar 23, 2011
Showing with 6 additions and 2 deletions.
  1. +5 −2 db/commands/distinct.cpp
  2. +1 −0 jstests/distinct1.js
View
@@ -88,8 +88,10 @@ namespace mongo {
}
-
-
+
+ assert( cursor );
+ string cursorName = cursor->toString();
+
scoped_ptr<ClientCursor> cc (new ClientCursor(QueryOption_NoCursorTimeout, cursor, ns));
while ( cursor->ok() ) {
@@ -139,6 +141,7 @@ namespace mongo {
b.appendNumber( "nscanned" , nscanned );
b.appendNumber( "nscannedObjects" , nscannedObjects );
b.appendNumber( "timems" , t.millis() );
+ b.append( "cursor" , cursorName );
result.append( "stats" , b.obj() );
}
View
@@ -25,3 +25,4 @@ t.save( { a : { b : "c" } , c : 12 } );
res = t.distinct( "a.b" );
assert.eq( "a,b,c" , res.toString() , "B1" );
+assert.eq( "BasicCursor" , t._distinct( "a.b" ).stats.cursor , "B2" )

0 comments on commit d2bb5fa

Please sign in to comment.