Skip to content

MongoDatabase

Description

Represents a server-side grouping of collections.

Method Descriptions

get_collection_names

func get_collection_names(filter: Dictionary)

Gets the names of the collections in this database.

Parameters

  • filter: Optional query expression to filter the returned collection names.

Returns: Array of collection names or error Dictionary

get_collection

func get_collection(name: String)

Obtains a collection which represents a logical grouping of documents within this database.

Parameters

  • name: Name of the collection to get

Returns: The MongoCollection or error Dictionary

create_collection

func create_collection(name: String, options: Dictionary)

Explicitly creates a collection in this database with the specified options.

Parameters

  • name: Name of the new collection
  • options: Optional options for the new collection

Returns: The newly created MongoCollection or error Dictionary

run_command

func run_command(command: Dictionary)

Runs a command against this database.

Parameters

  • command: Dictionary representing the command to be run

Returns: Result Dictionary or error Dictionary

drop

func drop()

Drops the database and all its collections.

Returns: True or error Dictionary

Back to top