.getCollection()

Returns the information and data from a collection.

getCollection(name)

Parameter

Description

name

String

The name of the collection

Returns

Description

The collection with the provided name

db.collections; // [Collection { name: 'users', entries: 1 }]

db.getCollection('users'); // Collection { name: 'users', entries: 1 }
db.getCollection('posts'); // null

Last updated