Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IFarmbotLogs

Hierarchy

Index

Constructors

constructor

  • Parameters

    • Optional doc: any

    Returns IFarmbotSchema

Properties

base

base: __module

Base Mongoose instance the model uses.

baseModelName

baseModelName: string

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: {}

Registered discriminators for this model.

Type declaration

  • [name: string]: Model<any>

events

events: EventEmitter

Event emitter that reports any errors that occurred. Useful for global error handling.

modelName

modelName: string

The name of the model

schema

schema: Schema<Document<any, {}>, Model<any, any>, undefined>

Schema the model uses.

Methods

$where

  • Adds a $where clause to this query

    Parameters

    • argument: string | Function

    Returns Query<IFarmbotSchema[], IFarmbotSchema, {}>

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

aggregate

  • aggregate<R>(pipeline?: any[]): Aggregate<R[]>
  • aggregate<R>(pipeline: any[], cb: Function): Promise<R[]>
  • Type parameters

    • R = any

    Parameters

    • Optional pipeline: any[]

    Returns Aggregate<R[]>

  • Type parameters

    • R = any

    Parameters

    • pipeline: any[]
    • cb: Function

    Returns Promise<R[]>

bulkWrite

  • bulkWrite(writes: any[], options?: CollectionBulkWriteOptions): Promise<BulkWriteOpResultObject>
  • bulkWrite(writes: any[], options?: CollectionBulkWriteOptions, cb?: (err: any, res: BulkWriteOpResultObject) => void): void
  • Sends multiple insertOne, updateOne, updateMany, replaceOne, deleteOne, and/or deleteMany operations to the MongoDB server in one command. This is faster than sending multiple independent operations (e.g. if you use create()) because with bulkWrite() there is only one round trip to MongoDB.

    Parameters

    • writes: any[]
    • Optional options: CollectionBulkWriteOptions

    Returns Promise<BulkWriteOpResultObject>

  • Parameters

    • writes: any[]
    • Optional options: CollectionBulkWriteOptions
    • Optional cb: (err: any, res: BulkWriteOpResultObject) => void
        • (err: any, res: BulkWriteOpResultObject): void
        • Parameters

          • err: any
          • res: BulkWriteOpResultObject

          Returns void

    Returns void

count

  • count(callback?: (err: any, count: number) => void): Query<number, IFarmbotSchema, {}>
  • count(filter: FilterQuery<IFarmbotSchema>, callback?: (err: any, count: number) => void): Query<number, IFarmbotSchema, {}>
  • Creates a count query: counts the number of documents that match filter.

    Parameters

    • Optional callback: (err: any, count: number) => void
        • (err: any, count: number): void
        • Parameters

          • err: any
          • count: number

          Returns void

    Returns Query<number, IFarmbotSchema, {}>

  • Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • Optional callback: (err: any, count: number) => void
        • (err: any, count: number): void
        • Parameters

          • err: any
          • count: number

          Returns void

    Returns Query<number, IFarmbotSchema, {}>

countDocuments

  • countDocuments(callback?: (err: any, count: number) => void): Query<number, IFarmbotSchema, {}>
  • countDocuments(filter: FilterQuery<IFarmbotSchema>, callback?: (err: any, count: number) => void): Query<number, IFarmbotSchema, {}>
  • Creates a countDocuments query: counts the number of documents that match filter.

    Parameters

    • Optional callback: (err: any, count: number) => void
        • (err: any, count: number): void
        • Parameters

          • err: any
          • count: number

          Returns void

    Returns Query<number, IFarmbotSchema, {}>

  • Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • Optional callback: (err: any, count: number) => void
        • (err: any, count: number): void
        • Parameters

          • err: any
          • count: number

          Returns void

    Returns Query<number, IFarmbotSchema, {}>

create

  • Creates a new document or documents

    Parameters

    Returns Promise<IFarmbotSchema>

  • Parameters

    Returns Promise<IFarmbotSchema[]>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Type parameters

    Parameters

    • docs: DocContents[]
    • Optional options: SaveOptions

    Returns Promise<IFarmbotSchema[]>

  • Type parameters

    Parameters

    • doc: DocContents

    Returns Promise<IFarmbotSchema>

  • Type parameters

    Parameters

    • Rest ...docs: DocContents[]

    Returns Promise<IFarmbotSchema[]>

  • Type parameters

    Parameters

    Returns void

  • Type parameters

    Parameters

    Returns void

createCollection

  • createCollection(options?: CollectionCreateOptions): Promise<Collection<IFarmbotSchema>>
  • createCollection(options: CollectionCreateOptions, callback: (err: NativeError, collection: Collection<IFarmbotSchema>) => void): void
  • Create the collection for this model. By default, if no indexes are specified, mongoose will not create the collection for the model until any documents are created. Use this method to create the collection explicitly.

    Parameters

    • Optional options: CollectionCreateOptions

    Returns Promise<Collection<IFarmbotSchema>>

  • Parameters

    • options: CollectionCreateOptions
    • callback: (err: NativeError, collection: Collection<IFarmbotSchema>) => void
        • Parameters

          Returns void

    Returns void

createIndexes

  • createIndexes(callback?: (err: any) => void): Promise<void>
  • createIndexes(options?: any, callback?: (err: any) => void): Promise<void>
  • Similar to ensureIndexes(), except for it uses the createIndex function.

    Parameters

    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

  • Parameters

    • Optional options: any
    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

deleteMany

  • deleteMany(filter?: FilterQuery<IFarmbotSchema>, options?: QueryOptions, callback?: (err: NativeError) => void): Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>
  • deleteMany(filter: FilterQuery<IFarmbotSchema>, callback: (err: NativeError) => void): Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>
  • deleteMany(callback: (err: NativeError) => void): Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>
  • Deletes all of the documents that match conditions from the collection. Behaves like remove(), but deletes all documents that match conditions regardless of the single option.

    Parameters

    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional options: QueryOptions
    • Optional callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>

  • Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>

  • Parameters

    • callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>

deleteOne

  • deleteOne(filter?: FilterQuery<IFarmbotSchema>, options?: QueryOptions, callback?: (err: NativeError) => void): Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>
  • deleteOne(filter: FilterQuery<IFarmbotSchema>, callback: (err: NativeError) => void): Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>
  • deleteOne(callback: (err: NativeError) => void): Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>
  • Deletes the first document that matches conditions from the collection. Behaves like remove(), but deletes at most one document regardless of the single option.

    Parameters

    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional options: QueryOptions
    • Optional callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>

  • Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>

  • Parameters

    • callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<{ n?: number; ok?: number } & { deletedCount?: number }, IFarmbotSchema, {}>

discriminator

  • discriminator<D>(name: string | number, schema: Schema<D, Model<any, any>, undefined>, value?: string): Model<D, {}>
  • discriminator<T, U>(name: string | number, schema: Schema<T, U, undefined>, value?: string): U
  • Adds a discriminator type.

    Type parameters

    • D: Document<any, {}, D>

    Parameters

    • name: string | number
    • schema: Schema<D, Model<any, any>, undefined>
    • Optional value: string

    Returns Model<D, {}>

  • Type parameters

    • T: Document<any, {}, T>

    • U: Model<T, {}, U>

    Parameters

    • name: string | number
    • schema: Schema<T, U, undefined>
    • Optional value: string

    Returns U

distinct

  • distinct(field: string, filter?: FilterQuery<IFarmbotSchema>, callback?: (err: any, count: number) => void): Query<any[], IFarmbotSchema, {}>
  • Creates a distinct query: returns the distinct values of the given field that match filter.

    Parameters

    • field: string
    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional callback: (err: any, count: number) => void
        • (err: any, count: number): void
        • Parameters

          • err: any
          • count: number

          Returns void

    Returns Query<any[], IFarmbotSchema, {}>

emit

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

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

    Returns boolean

ensureIndexes

  • ensureIndexes(callback?: (err: any) => void): Promise<void>
  • ensureIndexes(options?: any, callback?: (err: any) => void): Promise<void>
  • Sends createIndex commands to mongo for each index declared in the schema. The createIndex commands are sent in series.

    Parameters

    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

  • Parameters

    • Optional options: any
    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

estimatedDocumentCount

  • estimatedDocumentCount(options?: QueryOptions, callback?: (err: any, count: number) => void): Query<number, IFarmbotSchema, {}>
  • Creates a estimatedDocumentCount query: counts the number of documents in the collection.

    Parameters

    • Optional options: QueryOptions
    • Optional callback: (err: any, count: number) => void
        • (err: any, count: number): void
        • Parameters

          • err: any
          • count: number

          Returns void

    Returns Query<number, IFarmbotSchema, {}>

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

exists

  • exists(filter: FilterQuery<IFarmbotSchema>): Promise<boolean>
  • exists(filter: FilterQuery<IFarmbotSchema>, callback: (err: any, res: boolean) => void): void
  • Returns true if at least one document exists in the database that matches the given filter, and false otherwise.

    Parameters

    Returns Promise<boolean>

  • Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • callback: (err: any, res: boolean) => void
        • (err: any, res: boolean): void
        • Parameters

          • err: any
          • res: boolean

          Returns void

    Returns void

fetchCompletedSequences

  • fetchCompletedSequences(authorizationKey: string): Promise<string[]>
  • Fetch the sequences of the farmbot and get the completed one

    Parameters

    • authorizationKey: string

      API Token key

    Returns Promise<string[]>

    The completed sequences of the farmbot

    const key = '...'
    const completedSequences = await FarmbotLogs.fetchCompletedSequences(key)
    

fetchErrors

  • fetchErrors(authorizationKey: string): Promise<LogsRecord[]>
  • Fetch the logs of the farmbot from the API and get the errors

    Parameters

    • authorizationKey: string

      API Token key

    Returns Promise<LogsRecord[]>

    The errors of the farmbot

    const key = '...'
    const errors = await FarmbotLogs.fetchErrors(key)
    

fetchFarmbotDailySumup

  • fetchFarmbotDailySumup(authorizationKey: string): Promise<IFarmbotSchema>
  • Fetch the farmbot logs and create a sumup entry

    Parameters

    • authorizationKey: string

      API Token key

    Returns Promise<IFarmbotSchema>

    The sumup object created with the logs

    const key = '...'
    const dailySump = await FarmbotLogs.fetchFarmbotDailySumup(key)
    

fetchFarmbotSequences

  • fetchFarmbotSequences(authorizationKey: string): Promise<string[]>
  • Fetch the sequences of the farmbot

    Parameters

    • authorizationKey: string

      API Token key

    Returns Promise<string[]>

    The sequences of the farmbot

    const key = '...'
    const sequences = await FarmbotLogs.fetchFarmbotSequences(key)
    

fetchUncompletedSequences

  • fetchUncompletedSequences(authorizationKey: string): Promise<string[]>
  • Fetch the sequences of the farmbot and get the uncompleted one

    Parameters

    • authorizationKey: string

      API Token key

    Returns Promise<string[]>

    The uncompleted sequences of the farmbot

    const key = '...'
    const uncompletedSequences = await FarmbotLogs.fetchUncompletedSequences(key)
    

find

findById

  • Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().

    Parameters

    • id: any
    • Optional projection: any
    • Optional options: QueryOptions
    • Optional callback: (err: NativeError, doc: IFarmbotSchema) => void

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findByIdAndDelete

  • Creates a findByIdAndDelete query, filtering by the given _id.

    Parameters

    • Optional id: any
    • Optional options: QueryOptions
    • Optional callback: (err: any, doc: IFarmbotSchema, res: any) => void

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findByIdAndRemove

  • Creates a findByIdAndRemove query, filtering by the given _id.

    Parameters

    • Optional id: any
    • Optional options: QueryOptions
    • Optional callback: (err: any, doc: IFarmbotSchema, res: any) => void

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findByIdAndUpdate

  • Creates a findOneAndUpdate query, filtering by the given _id.

    Parameters

    • id: any
    • update: UpdateQuery<IFarmbotSchema>
    • options: QueryOptions & { rawResult: true }
    • Optional callback: (err: any, doc: FindAndModifyWriteOpResultObject<IFarmbotSchema>, res: any) => void
        • (err: any, doc: FindAndModifyWriteOpResultObject<IFarmbotSchema>, res: any): void
        • Parameters

          • err: any
          • doc: FindAndModifyWriteOpResultObject<IFarmbotSchema>
          • res: any

          Returns void

    Returns Query<FindAndModifyWriteOpResultObject<IFarmbotSchema>, IFarmbotSchema, {}>

  • Parameters

    • id: any
    • update: UpdateQuery<IFarmbotSchema>
    • options: QueryOptions & { upsert: true } & { new: true } & QueryOptions & { upsert: true } & { returnOriginal: false }
    • Optional callback: (err: any, doc: IFarmbotSchema, res: any) => void

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

  • Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

  • Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findOne

  • Finds one document.

    Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findOneAndDelete

  • Creates a findOneAndDelete query: atomically finds the given document, deletes it, and returns the document as it was before deletion.

    Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findOneAndRemove

  • Creates a findOneAndRemove query: atomically finds the given document and deletes it.

    Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findOneAndReplace

  • Creates a findOneAndReplace query: atomically finds the given document and replaces it with replacement.

    Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • replacement: _AllowStringsForIds<LeanDocument<IFarmbotSchema>>
    • options: QueryOptions & { upsert: true } & { new: true } & QueryOptions & { upsert: true } & { returnOriginal: false }
    • Optional callback: (err: any, doc: IFarmbotSchema, res: any) => void

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

  • Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

findOneAndUpdate

  • Creates a findOneAndUpdate query: atomically find the first document that matches filter and apply update.

    Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • update: UpdateQuery<IFarmbotSchema>
    • options: QueryOptions & { rawResult: true }
    • Optional callback: (err: any, doc: FindAndModifyWriteOpResultObject<IFarmbotSchema>, res: any) => void
        • (err: any, doc: FindAndModifyWriteOpResultObject<IFarmbotSchema>, res: any): void
        • Parameters

          • err: any
          • doc: FindAndModifyWriteOpResultObject<IFarmbotSchema>
          • res: any

          Returns void

    Returns Query<FindAndModifyWriteOpResultObject<IFarmbotSchema>, IFarmbotSchema, {}>

  • Parameters

    • filter: FilterQuery<IFarmbotSchema>
    • update: UpdateQuery<IFarmbotSchema>
    • options: QueryOptions & { upsert: true } & { new: true } & QueryOptions & { upsert: true } & { returnOriginal: false }
    • Optional callback: (err: any, doc: IFarmbotSchema, res: any) => void

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

  • Parameters

    Returns Query<IFarmbotSchema, IFarmbotSchema, {}>

geoSearch

getMaxListeners

  • getMaxListeners(): number
  • Returns number

hydrate

  • Shortcut for creating a new Document from existing raw data, pre-saved in the DB. The document returned has no paths marked as modified initially.

    Parameters

    • obj: any

    Returns IFarmbotSchema

init

  • This function is responsible for building indexes, unless autoIndex is turned off. Mongoose calls this function automatically when a model is created using mongoose.model() or connection.model(), so you don't need to call it.

    Parameters

    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<IFarmbotSchema>

insertMany

  • Inserts one or more new documents as a single insertMany call to the MongoDB server.

    Parameters

    Returns Promise<InsertManyResult>

  • Parameters

    Returns Promise<IFarmbotSchema>

  • Parameters

    Returns Promise<InsertManyResult>

  • Parameters

    Returns Promise<IFarmbotSchema[]>

  • Parameters

    Returns void

  • Parameters

    • docs: (IFarmbotSchema | _AllowStringsForIds<LeanDocument<IFarmbotSchema>>)[]
    • Optional options: InsertManyOptions
    • Optional callback: (err: NativeError, res: InsertManyResult | IFarmbotSchema[]) => void
        • Parameters

          Returns void

    Returns void

listIndexes

  • listIndexes(callback: (err: NativeError, res: any[]) => void): void
  • listIndexes(): Promise<any[]>
  • Lists the indexes currently defined in MongoDB. This may or may not be the same as the indexes defined in your schema depending on whether you use the autoIndex option and if you build indexes manually.

    Parameters

    • callback: (err: NativeError, res: any[]) => void
        • (err: NativeError, res: any[]): void
        • Parameters

          • err: NativeError
          • res: any[]

          Returns void

    Returns void

  • Returns Promise<any[]>

listenerCount

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

    • event: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

mapReduce

  • mapReduce<Key, Value>(o: MapReduceOptions<IFarmbotSchema, Key, Value>, callback?: (err: any, res: any) => void): Promise<any>
  • Executes a mapReduce command.

    Type parameters

    • Key

    • Value

    Parameters

    • o: MapReduceOptions<IFarmbotSchema, Key, Value>
    • Optional callback: (err: any, res: any) => void
        • (err: any, res: any): void
        • Parameters

          • err: any
          • res: any

          Returns void

    Returns Promise<any>

off

  • off(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

on

  • on(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

once

  • once(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

populate

  • populate(docs: any[], options: string | PopulateOptions | PopulateOptions[], callback?: (err: any, res: IFarmbotSchema[]) => void): Promise<IFarmbotSchema[]>
  • populate(doc: any, options: string | PopulateOptions | PopulateOptions[], callback?: (err: any, res: IFarmbotSchema) => void): Promise<IFarmbotSchema>
  • Populates document references.

    Parameters

    • docs: any[]
    • options: string | PopulateOptions | PopulateOptions[]
    • Optional callback: (err: any, res: IFarmbotSchema[]) => void

    Returns Promise<IFarmbotSchema[]>

  • Parameters

    • doc: any
    • options: string | PopulateOptions | PopulateOptions[]
    • Optional callback: (err: any, res: IFarmbotSchema) => void

    Returns Promise<IFarmbotSchema>

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

rawListeners

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

    • event: string | symbol

    Returns Function[]

remove

  • remove(filter?: any, callback?: (err: NativeError) => void): Query<any, IFarmbotSchema, {}>
  • Parameters

    • Optional filter: any
    • Optional callback: (err: NativeError) => void
        • (err: NativeError): void
        • Parameters

          • err: NativeError

          Returns void

    Returns Query<any, IFarmbotSchema, {}>

removeAllListeners

  • Parameters

    • Optional event: string | symbol

    Returns IFarmbotLogs

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): IFarmbotLogs
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns IFarmbotLogs

replaceOne

  • replaceOne(filter?: FilterQuery<IFarmbotSchema>, replacement?: _AllowStringsForIds<LeanDocument<IFarmbotSchema>>, options?: QueryOptions, callback?: (err: any, res: any) => void): Query<any, IFarmbotSchema, {}>
  • Creates a replaceOne query: finds the first document that matches filter and replaces it with replacement.

    Parameters

    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional replacement: _AllowStringsForIds<LeanDocument<IFarmbotSchema>>
    • Optional options: QueryOptions
    • Optional callback: (err: any, res: any) => void
        • (err: any, res: any): void
        • Parameters

          • err: any
          • res: any

          Returns void

    Returns Query<any, IFarmbotSchema, {}>

setMaxListeners

  • Parameters

    • n: number

    Returns IFarmbotLogs

startSession

  • startSession(options?: SessionOptions, cb?: (err: any, session: ClientSession) => void): Promise<ClientSession>
  • Starts a MongoDB session for benefits like causal consistency, retryable writes, and transactions.

    Parameters

    • Optional options: SessionOptions
    • Optional cb: (err: any, session: ClientSession) => void
        • (err: any, session: ClientSession): void
        • Parameters

          • err: any
          • session: ClientSession

          Returns void

    Returns Promise<ClientSession>

syncIndexes

  • syncIndexes(options?: Record<string, unknown>): Promise<string[]>
  • syncIndexes(options: Record<string, unknown>, callback: (err: NativeError, dropped: string[]) => void): void
  • Makes the indexes in MongoDB match the indexes defined in this model's schema. This function will drop any indexes that are not defined in the model's schema except the _id index, and build any indexes that are in your schema but not in MongoDB.

    Parameters

    • Optional options: Record<string, unknown>

    Returns Promise<string[]>

  • Parameters

    • options: Record<string, unknown>
    • callback: (err: NativeError, dropped: string[]) => void
        • (err: NativeError, dropped: string[]): void
        • Parameters

          • err: NativeError
          • dropped: string[]

          Returns void

    Returns void

translateAliases

  • translateAliases(raw: any): any
  • Translate any aliases fields/conditions so the final query or document object is pure

    Parameters

    • raw: any

    Returns any

update

  • deprecated

    use updateOne or updateMany instead. Creates a update query: updates one or many documents that match filter with update, based on the multi option.

    Parameters

    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional update: UpdateQuery<IFarmbotSchema>
    • Optional options: QueryOptions
    • Optional callback: (err: any, res: any) => void
        • (err: any, res: any): void
        • Parameters

          • err: any
          • res: any

          Returns void

    Returns Query<UpdateWriteOpResult, IFarmbotSchema, {}>

updateMany

  • Creates a updateMany query: updates all documents that match filter with update.

    Parameters

    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional update: UpdateQuery<IFarmbotSchema>
    • Optional options: QueryOptions
    • Optional callback: (err: any, res: any) => void
        • (err: any, res: any): void
        • Parameters

          • err: any
          • res: any

          Returns void

    Returns Query<UpdateWriteOpResult, IFarmbotSchema, {}>

updateOne

  • Creates a updateOne query: updates the first document that matches filter with update.

    Parameters

    • Optional filter: FilterQuery<IFarmbotSchema>
    • Optional update: UpdateQuery<IFarmbotSchema>
    • Optional options: QueryOptions
    • Optional callback: (err: any, res: any) => void
        • (err: any, res: any): void
        • Parameters

          • err: any
          • res: any

          Returns void

    Returns Query<UpdateWriteOpResult, IFarmbotSchema, {}>

validate

  • validate(callback?: (err: any) => void): Promise<void>
  • validate(optional: any, callback?: (err: any) => void): Promise<void>
  • validate(optional: any, pathsToValidate: string[], callback?: (err: any) => void): Promise<void>
  • Casts and validates the given object against this model's schema, passing the given context to custom validators.

    Parameters

    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

  • Parameters

    • optional: any
    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

  • Parameters

    • optional: any
    • pathsToValidate: string[]
    • Optional callback: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns Promise<void>

watch

  • watch(pipeline?: Record<string, unknown>[], options?: ChangeStreamOptions): ChangeStream<any>
  • Watches the underlying collection for changes using MongoDB change streams.

    Parameters

    • Optional pipeline: Record<string, unknown>[]
    • Optional options: ChangeStreamOptions

    Returns ChangeStream<any>

where

  • Creates a Query, applies the passed conditions, and returns the Query.

    Parameters

    • path: string
    • Optional val: any

    Returns Query<IFarmbotSchema[], IFarmbotSchema, {}>

  • Parameters

    • obj: object

    Returns Query<IFarmbotSchema[], IFarmbotSchema, {}>

  • Returns Query<IFarmbotSchema[], IFarmbotSchema, {}>

Generated using TypeDoc