Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Collection

Hierarchy

  • Collection

Implements

  • ICollection

Index

Constructors

constructor

  • new Collection(collectionName: string, collectionConfig: ICollectionConfig, camaConfig: ICamaConfig): Collection

Properties

Private aggregator

aggregator: IAggregator

Private Optional config

config?: ICollectionConfig

container

container: Container

Private destroyed

destroyed: boolean = false

Private logger

logger: ILogger

Private Optional name

name?: string

Private persistenceAdapter

persistenceAdapter: IPersistenceAdapter

Private queryService

queryService: IQueryService<any>

queue

queue: IQueueService

Methods

aggregate

  • aggregate(pipeline: any[]): Promise<any>
  • Perform MongoDB style aggregations

    Parameters

    • pipeline: any[]

    Returns Promise<any>

Private checkDestroyed

  • checkDestroyed(): void

destroy

  • destroy(): Promise<void>
  • Destroy the collection

    remarks

    After calling this, the collection instance becomes unusable

    Returns Promise<void>

findMany

  • findMany<T>(query: any, options?: IQueryOptions): Promise<IFilterResult<T>>
  • Find many rows from the collection

    remarks

    Lazily loads collection into cache, subsequent calls are significantly faster

    Type parameters

    • T

    Parameters

    • query: any

      Query Object

    • Optional options: IQueryOptions

      Query options

    Returns Promise<IFilterResult<T>>

insertMany

  • insertMany(rows: any[]): Promise<void>
  • Insert many values into collection

    Parameters

    • rows: any[]

      The values to be inserted

    Returns Promise<void>

insertOne

  • insertOne(row: any): Promise<void>
  • Inserts 1 value into collection

    remarks

    Essentially syntactic sugar - internally calls the same function as insertMany

    Parameters

    • row: any

    Returns Promise<void>

updateMany

  • updateMany<T>(query: any, delta: any): Promise<void>
  • Update all matched rows

    Type parameters

    • T

    Parameters

    • query: any
    • delta: any

    Returns Promise<void>

Generated using TypeDoc