Skip to main content

MongoDatabase

Allows you to interact with the database in MongoDB.


collection


collection(name: string) : MongoCollection

Description

Gets a MongoCollection by name.

Attributes
NAMETYPEDESCRIPTION
namestringThe name of the collection.
Return

( MongoCollection )

The MongoCollection wrapper.


collectionNames


collectionNames() : java.util.List<string>

Description

Lists all collection names in the database.

Return

( java.util.List )

The list of collection names.


createCollection


createCollection(name: string) : MongoDatabase

Description

Creates a new collection with the given name.

Attributes
NAMETYPEDESCRIPTION
namestringThe name of the collection.
Return

( MongoDatabase )

This MongoDatabase instance for chaining.


getCollection


getCollection(name: string) : MongoCollection

Description

Gets a MongoCollection by name.

Attributes
NAMETYPEDESCRIPTION
namestringThe name of the collection.
Return

( MongoCollection )

The MongoCollection wrapper.


ping


ping() : MongoDatabase

Description

Tests the connection to the database by running the ping command.

Return

( MongoDatabase )

This MongoDatabase instance for chaining.