Options
All
  • Public
  • Public/Protected
  • All
Menu

Runs queries on a single MongoDB connection.

Hierarchy

  • MongoQueryRunner

Implements

Index

Constructors

constructor

Properties

broadcaster

broadcaster: Broadcaster

Broadcaster used on this query runner to broadcast entity events.

connection

connection: Connection

Connection used by this query runner.

data

data: object

Stores temporarily user data. Useful for sharing data with subscribers.

Type declaration

databaseConnection

databaseConnection: Db

Real database connection from a connection pool used to perform queries.

isReleased

isReleased: boolean = false

Indicates if connection for this query runner is released. Once its released, query runner cannot run queries anymore. Always false for mongodb since mongodb has a single query executor instance.

isTransactionActive

isTransactionActive: boolean = false

Indicates if transaction is active in this query executor. Always false for mongodb since mongodb does not support transactions.

loadedTables

loadedTables: Table[]

All synchronized tables in the database.

manager

Entity manager working only with current query runner.

Methods

addColumn

addColumns

  • addColumns(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

aggregate

bulkWrite

changeColumn

changeColumns

  • changeColumns(tableOrName: Table | string, changedColumns: object[]): Promise<void>

clearDatabase

  • clearDatabase(): Promise<void>
  • Removes all collections from the currently connected database. Be careful with using this method and avoid using it in production or migrations (because it can clear all your database).

    Returns Promise<void>

clearSqlMemory

  • clearSqlMemory(): void

clearTable

  • clearTable(collectionName: string): Promise<void>

collectionIndexExists

  • collectionIndexExists(collectionName: string, indexes: string | string[]): Promise<boolean>

collectionIndexInformation

  • collectionIndexInformation(collectionName: string, options?: undefined | object): Promise<any>

collectionIndexes

  • collectionIndexes(collectionName: string): Promise<any>

commitTransaction

  • commitTransaction(): Promise<void>

connect

  • connect(): Promise<any>

count

createCheckConstraint

  • createCheckConstraint(tableOrName: Table | string, checkConstraint: TableCheck): Promise<void>

createCheckConstraints

  • createCheckConstraints(tableOrName: Table | string, checkConstraints: TableCheck[]): Promise<void>

createCollectionIndex

  • createCollectionIndex(collectionName: string, fieldOrSpec: string | any, options?: MongodbIndexOptions): Promise<string>

createCollectionIndexes

  • createCollectionIndexes(collectionName: string, indexSpecs: ObjectLiteral[]): Promise<void>

createDatabase

  • createDatabase(database: string): Promise<void>

createForeignKey

createForeignKeys

createIndex

  • createIndex(tableOrName: Table | string, index: TableIndex): Promise<void>

createIndices

  • createIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void>

createPrimaryKey

  • createPrimaryKey(tableOrName: Table | string, columnNames: string[]): Promise<void>

createSchema

  • createSchema(schema: string, ifNotExist?: undefined | true | false): Promise<void>

createTable

  • createTable(table: Table): Promise<void>

createUniqueConstraint

  • createUniqueConstraint(tableOrName: Table | string, uniqueConstraint: TableUnique): Promise<void>

createUniqueConstraints

  • createUniqueConstraints(tableOrName: Table | string, uniqueConstraints: TableUnique[]): Promise<void>

cursor

deleteMany

deleteOne

disableSqlMemory

  • disableSqlMemory(): void

distinct

  • distinct(collectionName: string, key: string, query: ObjectLiteral, options?: undefined | object): Promise<any>
  • The distinct command returns returns a list of distinct values for the given key across a collection.

    Parameters

    • collectionName: string
    • key: string
    • query: ObjectLiteral
    • Optional options: undefined | object

    Returns Promise<any>

dropCheckConstraint

  • dropCheckConstraint(tableOrName: Table | string, checkOrName: TableCheck | string): Promise<void>

dropCheckConstraints

  • dropCheckConstraints(tableOrName: Table | string, checkConstraints: TableCheck[]): Promise<void>

dropCollectionIndex

  • dropCollectionIndex(collectionName: string, indexName: string, options?: CollectionOptions): Promise<any>

dropCollectionIndexes

  • dropCollectionIndexes(collectionName: string): Promise<any>

dropColumn

  • dropColumn(tableOrName: Table | string, columnOrName: TableColumn | string): Promise<void>

dropColumns

  • dropColumns(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

dropDatabase

  • dropDatabase(database: string, ifExist?: undefined | true | false): Promise<void>

dropForeignKey

dropForeignKeys

dropIndex

  • dropIndex(collectionName: string, indexName: string): Promise<void>

dropIndices

  • dropIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void>

dropPrimaryKey

  • dropPrimaryKey(tableOrName: Table | string): Promise<void>

dropSchema

  • dropSchema(schemaPath: string, ifExist?: undefined | true | false): Promise<void>

dropTable

  • dropTable(tableName: Table | string): Promise<void>

dropUniqueConstraint

  • dropUniqueConstraint(tableOrName: Table | string, uniqueOrName: TableUnique | string): Promise<void>

dropUniqueConstraints

  • dropUniqueConstraints(tableOrName: Table | string, uniqueConstraints: TableUnique[]): Promise<void>

enableSqlMemory

  • enableSqlMemory(): void

executeMemoryDownSql

  • executeMemoryDownSql(): Promise<void>

executeMemoryUpSql

  • executeMemoryUpSql(): Promise<void>

findOneAndDelete

findOneAndReplace

findOneAndUpdate

geoHaystackSearch

geoNear

  • geoNear(collectionName: string, x: number, y: number, options?: GeoNearOptions): Promise<any>

Protected getCollection

  • getCollection(collectionName: string): Collection

getDatabases

  • getDatabases(): Promise<string[]>

getMemorySql

getSchemas

  • getSchemas(database?: undefined | string): Promise<string[]>
  • Returns all available schema names including system schemas. If database parameter specified, returns schemas of that database.

    Parameters

    • Optional database: undefined | string

    Returns Promise<string[]>

getTable

  • getTable(collectionName: string): Promise<Table | undefined>

getTables

  • getTables(collectionNames: string[]): Promise<Table[]>

group

  • group(collectionName: string, keys: Object | Array<any> | Function | Code, condition: Object, initial: Object, reduce: Function | Code, finalize: Function | Code, command: boolean, options?: undefined | object): Promise<any>
  • Run a group command across a collection.

    Parameters

    • collectionName: string
    • keys: Object | Array<any> | Function | Code
    • condition: Object
    • initial: Object
    • reduce: Function | Code
    • finalize: Function | Code
    • command: boolean
    • Optional options: undefined | object

    Returns Promise<any>

hasColumn

  • hasColumn(tableOrName: Table | string, columnName: string): Promise<boolean>

hasDatabase

  • hasDatabase(database: string): Promise<boolean>

hasSchema

  • hasSchema(schema: string): Promise<boolean>

hasTable

  • hasTable(collectionName: string): Promise<boolean>

initializeOrderedBulkOp

initializeUnorderedBulkOp

insertMany

insertOne

isCapped

  • isCapped(collectionName: string): Promise<any>

listCollectionIndexes

  • listCollectionIndexes(collectionName: string, options?: undefined | object): CommandCursor

mapReduce

  • mapReduce(collectionName: string, map: Function | string, reduce: Function | string, options?: MapReduceOptions): Promise<any>
  • Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.

    Parameters

    • collectionName: string
    • map: Function | string
    • reduce: Function | string
    • Optional options: MapReduceOptions

    Returns Promise<any>

parallelCollectionScan

query

  • query(query: string, parameters?: any[]): Promise<any>

reIndex

  • reIndex(collectionName: string): Promise<any>
  • Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.

    Parameters

    • collectionName: string

    Returns Promise<any>

release

  • release(): Promise<void>

rename

  • rename(collectionName: string, newName: string, options?: undefined | object): Promise<Collection>
  • Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.

    Parameters

    • collectionName: string
    • newName: string
    • Optional options: undefined | object

    Returns Promise<Collection>

renameColumn

  • renameColumn(tableOrName: Table | string, oldTableColumnOrName: TableColumn | string, newTableColumnOrName: TableColumn | string): Promise<void>

renameTable

  • renameTable(oldTableOrName: Table | string, newTableOrName: Table | string): Promise<void>

replaceOne

rollbackTransaction

  • rollbackTransaction(): Promise<void>

startTransaction

  • startTransaction(): Promise<void>

stats

  • stats(collectionName: string, options?: undefined | object): Promise<CollStats>

stream

  • stream(query: string, parameters?: any[], onEnd?: Function, onError?: Function): Promise<ReadStream>

updateMany

updateOne

updatePrimaryKeys

  • updatePrimaryKeys(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

Generated using TypeDoc