[DOCS-3918] Document the listCollections command Created: 18/Aug/14  Updated: 16/Mar/15  Resolved: 12/Nov/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: v1.3.14, mongodb-3.0

Type: Task Priority: Major - P3
Reporter: Kamran K. Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-4515 Remove/replace all occurrences of sys... Closed
related to DOCS-3919 Document the listCollections privileg... Closed
is related to SERVER-2442 Add list[Collections] command Closed
Participants:
Days since reply: 9 years, 9 weeks ago

 Description   

See SERVER-2442

Example usage:

> show collections
fts_index3
search
system.indexes
 
//
// plain listCollections
//
> db.runCommand('listCollections');
{
	"collections" : [
		{
			"name" : "fts_index3",
			"options" : {
				"flags" : 1
			}
		},
		{
			"name" : "search",
			"options" : {
				"flags" : 1
			}
		},
		{
			"name" : "system.indexes",
			"options" : {
				
			}
		}
	],
	"ok" : 1
}
 
//
// listCollections with a filter parameter ('fts_index3' has been filtered)
//
> db.runCommand('listCollections', {filter: {name: /^s/}});
{
	"collections" : [
		{
			"name" : "search",
			"options" : {
				"flags" : 1
			}
		},
		{
			"name" : "system.indexes",
			"options" : {
				
			}
		}
	],
	"ok" : 1
}



 Comments   
Comment by Githook User [ 17/Dec/14 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-3918 DOCS-3919: listCollections documentation
Branch: master
https://github.com/mongodb/docs/commit/ae56e2740beedaed2c41f14b8317eddf42920789

Comment by Randolph Tan [ 07/Nov/14 ]

Note: filtering with the other attributes is also possible:

db.runCommand( { listCollections: 1, filter: { 'options.capped': true } } );

Generated at Thu Feb 08 07:46:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.