- Stitch >
- MongoDB Atlas >
- Reference >
- MongoDB Actions
database.collection()¶
On this page
Definition¶
-
database.
collection
()¶
Return a collection handle object that represents a collection in a
database
.
Usage¶
Example¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
To call the database.collection()
action from a
Function, get a database handle with
mongodb.db()
then call the handle’s collection()
method.
To call the database.collection()
action from a JavaScript
SDK, use the RemoteMongoDatabase.collection() method.
To call the database.collection()
action from the
Java/Android SDK, use the RemoteMongoDatabase.collection() method.
To call the database.collection()
action from the Swift/iOS
SDK, use the RemoteMongoDatabase.collection() method.
Parameters¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
The database.collection()
action has the following form:
The collection() method has the following form:
The getCollection() method has the following form:
The collection() method has the following form:
Parameter | Description |
---|---|
Collection Name name: <string> |
The name of the collection. The collection must exist in the database associated with the database handle object. |
Return Value¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
The database.collection()
action returns a collection
object that allows you to query the specified collection.
The RemoteMongoDatabase.collection() method returns a RemoteMongoCollection object that allows you to query the specified collection.
The RemoteMongoDatabase.getCollection() method returns a RemoteMongoCollection object that allows you to query the specified collection.
The RemoteMongoDatabase.collection() method returns a RemoteMongoCollection object that allows you to query the specified collection.