Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Properties

Optional __v

__v: undefined | number

Version using default version key. See http://mongoosejs.com/docs/guide.html#versionKey If you're using another key, you will have to access it using []: doc[_myVersionKey]

base

base: "mongoose"

Base Mongoose instance the model uses.

baseModelName

baseModelName: string | undefined

If this is a discriminator model, baseModelName is the name of the base model.

collection

collection: Collection

Collection the model uses.

db

db: Connection

Connection the model uses.

discriminators

discriminators: any

Registered discriminators for this model.

Optional id

id: any

Virtual getter that by default returns the document's _id field cast to a string, or in the case of ObjectIds, its hexString. This id getter may be disabled by passing the option { id: false } at schema construction time. If disabled, id behaves like any other field on a document and can be assigned any value.

modelName

modelName: string

The name of the model

schema

schema: Schema

Schema the model uses.

Optional subjects

subjects: Maybe<string[][]>

subjects[0] is an array of subjects for Monday, subjects[5] - for Saturday, there is no subjects[6] (Sunday) schedule

AcademicSubjectDoc.name[][], may be empty

Methods

_randomTimesPerWeek

  • _randomTimesPerWeek(this: WeekScheduleDoc, subjectsAmount: number): object
  • Returns a number[] of subjectsAmount length and its sum in an object. This array defines the number of times each subject appears in the schedule.

    remarks

    E.g. if subjects: ['Math', 'English', 'Programming'], then subjectsAmount === subjects.length === 3, and this function returns { timesSum: 5, timesPerWeek: [1, 2, 2] } timesPerWeek numbers are genrated randomly according to some restrictions. Returned data means, that 'Math' appears 1 time in a week schedule and 'English' and 'Propgramming' appear 2 times in the schedule.

    Parameters

    • this: WeekScheduleDoc
    • subjectsAmount: number

      Length of times array to generate.

    Returns object

_setRandomSchedule

  • _setRandomSchedule(this: WeekScheduleDoc, subjects: object[]): Promise<void>

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

increment

  • increment(): this
  • Signal that we desire an increment of this documents version.

    Returns this

isDeleted

  • isDeleted(isDeleted: boolean): void
  • isDeleted(): boolean
  • Override whether mongoose thinks this doc is deleted or not

    Parameters

    • isDeleted: boolean

    Returns void

  • whether mongoose thinks this doc is deleted.

    Returns boolean

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

model

  • model(name: string): Model<this>
  • Returns another Model instance.

    Parameters

    • name: string

      model name

    Returns Model<this>

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

remove

  • remove(fn?: undefined | function): Promise<this>
  • Removes this document from the db.

    Parameters

    • Optional fn: undefined | function

      optional callback

    Returns Promise<this>

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

save

  • save(options?: SaveOptions, fn?: undefined | function): Promise<this>
  • save(fn?: undefined | function): Promise<this>
  • Saves this document.

    Parameters

    • Optional options: SaveOptions

      options optional options

    • Optional fn: undefined | function

      optional callback

    Returns Promise<this>

  • Parameters

    • Optional fn: undefined | function

    Returns Promise<this>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setRandomSchedule

  • Sets subjects to be a random matrix of AcademicSubjectDoc.name. Generates at max Const.MaxSubjectTimesPerWeek entries of subject per week. Does not corrupt state in case of an error. Does not write any changes to the database. As it is a subdocument, it will be saved only with its parent document.

    throws

    NotEnoughSubjectsForScheduleError if there are not enough subjects, registered in the database to make a schedule.

    throws

    ApolloError if a database read/write error occurs.

    Parameters

    Returns Promise<void>

todaySubjects

Generated using TypeDoc