-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.0.15
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
From v2.0.15, first element in returned Array is <db>.<collection>, but other elements are only <collection>.
db.listCollections was correctly working util v2.0.14.
(function(){ /** * Test code of db.listCollections * test_listCollections.js */ "use strict"; var Mongo = require('mongodb'); var MongoClient = Mongo.MongoClient; var url = 'mongodb://localhost:27017/testListCollections'; MongoClient.connect(url, null, function(err, db){ db.createCollection('test1', function(r){ db.createCollection('test2', function(r){ db.createCollection('test3', function(r){ db.listCollections().toArray(console.log); }); }); }); }); })();
results
$ rm -rf node_modules/mongodb/ $ npm install mongodb@2.0.14 mongodb@2.0.14 node_modules/mongodb ├── readable-stream@1.0.31 (isarray@0.0.1, inherits@2.0.1, string_decoder@0.10.31, core-util-is@1.0.1) └── mongodb-core@1.1.9 (rimraf@2.2.6, mkdirp@0.5.0, kerberos@0.0.8, bson@0.2.18) $ node test_listCollections.js null [ { name: 'system.indexes', options: {} }, { name: 'test1', options: { flags: 1 } }, { name: 'test2', options: { flags: 1 } }, { name: 'test3', options: { flags: 1 } } ] $ rm -rf node_modules/mongodb/ $ npm install mongodb@2.0.15 mongodb@2.0.15 node_modules/mongodb ├── readable-stream@1.0.31 (isarray@0.0.1, string_decoder@0.10.31, inherits@2.0.1, core-util-is@1.0.1) └── mongodb-core@1.1.11 (rimraf@2.2.6, mkdirp@0.5.0, kerberos@0.0.8, bson@0.2.18) $ node test_listCollections.js null [ { name: 'testListCollections.system.indexes', options: {} }, { name: 'test1', options: { flags: 1 } }, { name: 'test2', options: { flags: 1 } }, { name: 'test3', options: { flags: 1 } } ]