[SERVER-15987] listCollections and getIndexes empty on wiredtiger when using old shell Created: 06/Nov/14  Updated: 29/May/21  Resolved: 06/Nov/14

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: Scott Hernandez (Inactive) Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: wiredtiger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-16128 Some pre-2.8 CLI shell functions inco... Closed
is duplicated by SERVER-16267 Show Tables/Collections fails with 2.... Closed
is duplicated by SERVER-16361 Show collections returns empty list Closed
Related
is related to SERVER-16224 db.getCollectionNames() returns empty... Closed
is related to DOCS-4293 Old shell with wiredtiger will not re... Closed
is related to SERVER-16225 Emulate query results for system.name... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

test7:PRIMARY> show collections
test7:PRIMARY> db.a.insert({a:1})
WriteResult({ "nInserted" : 1 })
test7:PRIMARY> show collections
test7:PRIMARY> db.a.find()
{ "_id" : ObjectId("545b6bba4cabb8d975e9e665"), "a" : 1 }
{ "_id" : ObjectId("545b6bba4cabb8d975e9e665"), "a" : 1 }
Type "it" for more
test7:PRIMARY> show collections
test7:PRIMARY> db.adminCommand("listCollections")
{ "collections" : [ ], "ok" : 1 }
test7:PRIMARY> use local
switched to db local
test7:PRIMARY> db.adminCommand("listCollections")
{ "collections" : [ ], "ok" : 1 }
test7:PRIMARY> show collections
test7:PRIMARY> db.oplog.rs.stats()
{
	"ns" : "local.oplog.rs",
	"count" : 2097152,
	"size" : 201326592,
	"avgObjSize" : 96,
	"storageSize" : 89,
	"nindexes" : 0,
	"capped" : true,
	"max" : -1,
	"maxSize" : 201326592,
	"wiredtiger" : {
		"uri" : "statistics:table:collection-6-2589753951712478342",
		"LSM" : {
...



 Comments   
Comment by Piotr Wasiewicz [ 29/May/21 ]

I cannot see the collections in mongo shell 4.0.24 from mongoserver 4.0.24 atlas AWS. I have no admin access.

Comment by Vineet Sharma [ 15/Oct/15 ]

I can confirm that I'm seeing thi behaviour in mongo shell 3.0.7 as well. I'm able to see the collections for the admin db but not for other dbs.

Comment by Scott Hernandez (Inactive) [ 06/Nov/14 ]

Yep, 2.6.5 shell. We should doc this, as I expect it won't be the last time.

Comment by Eliot Horowitz (Inactive) [ 06/Nov/14 ]

adminCommand will run the command on the admin database which has no collections.
my guess is you have an old shell version.
try db.runCommand( "listCollections" )
and then a new shell version.

Comment by Scott Hernandez (Inactive) [ 06/Nov/14 ]

We need to add basic jstests, which we don't currently have, it seems.

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