Skip to content

Commit 48322a0

Browse files
committed
RUBY-843 Take ns into account and add cursor option to commands
1 parent d5207cd commit 48322a0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/mongo/db.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def collections_info(coll_name=nil)
289289
if @client.wire_version_feature?(Mongo::MongoClient::MONGODB_2_8)
290290
cmd = BSON::OrderedHash[:listCollections, 1]
291291
cmd.merge!(:filter => { :name => coll_name }) if coll_name
292-
result = self.command(cmd)
292+
result = self.command(cmd, :cursor => {})
293293
if result.key?('cursor')
294294
cursor_info = result['cursor']
295295
pinned_pool = @connection.pinned_pool
@@ -298,7 +298,8 @@ def collections_info(coll_name=nil)
298298
seed = {
299299
:cursor_id => cursor_info['id'],
300300
:first_batch => cursor_info['firstBatch'],
301-
:pool => pinned_pool
301+
:pool => pinned_pool,
302+
:ns => cursor_info['ns']
302303
}
303304

304305
Cursor.new(self, seed.merge!(opts)).collect { |doc| doc['collections'] }
@@ -508,7 +509,7 @@ def drop_index(collection_name, index_name)
508509
# defining the index.
509510
def index_information(collection_name)
510511
if @client.wire_version_feature?(Mongo::MongoClient::MONGODB_2_8)
511-
result = self.command(:listIndexes => collection_name)
512+
result = self.command({ :listIndexes => collection_name }, :cursor => {})
512513
if result.key?('cursor')
513514
cursor_info = result['cursor']
514515
pinned_pool = @connection.pinned_pool
@@ -517,7 +518,8 @@ def index_information(collection_name)
517518
seed = {
518519
:cursor_id => cursor_info['id'],
519520
:first_batch => cursor_info['firstBatch'],
520-
:pool => pinned_pool
521+
:pool => pinned_pool,
522+
:ns => cursor_info['ns']
521523
}
522524

523525
indexes = Cursor.new(self, seed.merge!(opts)).collect { |doc| doc['indexes'] }

0 commit comments

Comments
 (0)