Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MongoGo

Hierarchy

  • MongoGo

Index

Constructors

constructor

  • new MongoGo(MongoURI: string): MongoGo
  • Parameters

    • MongoURI: string

    Returns MongoGo

Properties

Private MongoGoCollection

MongoGoCollection: Collection<string, any> = ...

Private schema

schema: Model<MongoGoSchema, {}, {}, {}, any> = ...

Methods

collection

  • Returns Promise<Collection<string, any>>

    Cached data with self-made Collection class

delete

  • delete(key: string): Promise<void>
  • Removes data from the database using the "key" as the id of the object in the container.

    example

    .delete("Hello")

    // The client gets container/object literal with the key "Hello", and deletes the data and // the object itself

    Parameters

    • key: string

      The key you wish to delete

    Returns Promise<void>

get

  • get(key: string): Promise<any>
  • Gets data from the database using a "key" given and returns an Object literal.

    example

    .get('Hello')

    // The client uses the key provided as an id to search for the data in the database and returns nothing if no data is found.

    Parameters

    • key: string

      The key you wish to get data

    Returns Promise<any>

push

  • push(key: string, ...pushValue: string[]): Promise<void>
  • Pushes data to an array using a "key" given, can be used when handling multiple values in a key. However, only Object or Array-like formats are available for the value to be push, otherwise an error is called.

    example

    .push("Hello", ["World", "Earth", "Moon"])

    // The client first checks if the value is an array, if not an error is thrown // Otherwise, the value is then pushed into the data

    Parameters

    • key: string

      The key you wish to push data to

    • Rest ...pushValue: string[]

    Returns Promise<void>

Private ready

  • ready(): Promise<void>
  • Returns Promise<void>

set

  • set(key: string, value: any): Promise<void>
  • Saves data to the database in an easy format with 2 needed providers, "key" and "value".

    example

    .set("Hello", "World")

    // This makes the key as "Hello", value as "World" and stores it in the database.

    Parameters

    • key: string

      The key, so you can get it with .get("key")

    • value: any

      value The value which will be saved to the key

    Returns Promise<void>

Generated using TypeDoc