Class: DatabaseServer

DatabaseServer(setup)

new DatabaseServer(setup)

Creates an instance of DatabaseServer.

Parameters:
Name Type Description
setup Object

The configuration setup for the database server.

Properties
Name Type Attributes Default Description
dbName string

The name of the database.

HOST string <optional>
'mongodb://0.0.0.0:27017/'

The host URL for the MongoDB server.

collections Array <optional>

Additional collections to be initialized along with the default ones.

Source:

Members

DBServer :mongoose.Connection

The MongoDB server instance.

Type:
  • mongoose.Connection
Source:

HOST :string

The host URL for the MongoDB server.

Type:
  • string
Source:

collections :Array

An array containing the initialized collections.

Type:
  • Array
Source:

dbName :string

The name of the database.

Type:
  • string
Source:

Methods

init(callbacks) → {DatabaseServer}

Initializes the database connection and sets up the collections.

Parameters:
Name Type Description
callbacks Object

Success and error callbacks for database initialization.

Properties
Name Type Description
success function

The success callback function to be executed after successful database connection.

error function

The error callback function to be executed if the database connection fails.

Source:
Returns:

The DatabaseServer instance.

Type
DatabaseServer