Options
All
  • Public
  • Public/Protected
  • All
Menu

Mongo Portable

Index

Variables

MACHINE_ID

MACHINE_ID: number = parseInt(`${Math.random() * 0xFFFFFF}`, 10)

Machine id.

Create a random 3-byte value (i.e. unique for this process). Other drivers use a md5 of the machine id here, but that would mean an asyc call to gethostname, so we don"t bother.

ignore

checkForHexRegExp

checkForHexRegExp: RegExp = new RegExp("^[0-9a-fA-F]{24}$")

chr

chr: fromCharCode = String.fromCharCode

database

database: any = null

Collection

module

Collection

constructor
since

0.0.1

author

Eduardo Astolfi eastolfi91@gmail.com

copyright

2016 Eduardo Astolfi eastolfi91@gmail.com

license

MIT Licensed

classdesc

Collection class that maps a MongoDB-like collection

maxBits

maxBits: Array<any> = []

pid

pid: number = Math.floor(Math.random() * 100000)

Functions

_applyModifier

  • _applyModifier(_docUpdate: any, key: any, val: any): any

_ensureFindParams

  • _ensureFindParams(params: any): any

Private _getDocuments

  • _getDocuments(cursor: any, justOne?: boolean): any
  • Retrieves one or all the documents in the cursor

    Parameters

    • cursor: any

      The cursor with the documents

    • Default value justOne: boolean = false

    Returns any

    If [justOne=true] returns the next document, otherwise returns all the documents

_mapFields

  • _mapFields(doc: any, fields: any): any

_modify

  • _modify(document: any, keyparts: any, value: any, key: any, level?: number): any
  • Parameters

    • document: any
    • keyparts: any
    • value: any
    • key: any
    • Default value level: number = 0

    Returns any

_testClause

  • _testClause(clause: any, val: any): any

_testLogicalClause

  • _testLogicalClause(clause: any, doc: any, key: any): any

_testObjectClause

  • _testObjectClause(clause: any, doc: any, key: any): any

_testOperatorClause

  • _testOperatorClause(clause: any, value: any): boolean

_testOperatorConstraint

  • _testOperatorConstraint(key: any, operatorValue: any, clauseValue: any, docVal: any, clause: any): any

do_complex_group

  • do_complex_group(): void

do_group

  • do_group(documents: any, group_stage: any): Array<Object>

do_match

  • do_match(documents: any, match_stage: any): any

do_project

  • do_project(documents: any, project_stage: any): any

do_single_group

  • do_single_group(group_id: any, group_stage: any, documents: any): Array<Object>

do_sort

  • do_sort(documents: any, sort_stage: any): any

getObjectSize

  • getObjectSize(obj: any): number
  • Gets the size of an object.

    Parameters

    • obj: any

      The object

    Returns number

    The size of the object

Private hasSorting

  • hasSorting(cursor: any): boolean
  • Checks if a cursor has a sorting defined

    Parameters

    • cursor: any

      The cursor

    Returns boolean

    Whether the cursor has sorting or not

isValidHexRegExp

  • isValidHexRegExp(str: any, len?: number): boolean

Object literals

BsonTypes

BsonTypes: object

_types

_types: Array<object | object> = [{ alias: "minKey", number: -1, order: 1, isType: null },{ alias: "null", number: 10, order: 2, isType: null },{ alias: "int", number: 16, order: 3, isType: _.isInteger },{ alias: "long", number: 18, order: 3, isType: _.isNumber },{ alias: "double", number: 1, order: 3, isType: _.isNumber },{ alias: "number", number: null, order: 3, isType: _.isNumber },{ alias: "string", number: 2, order: 4, isType: _.isString },{ alias: "symbol", number: 14, order: 4, isType: _.isSymbol },{ alias: "object", number: 3, order: 5, isType: _.isPlainObject },{ alias: "array", number: 4, order: 6, isType: _.isArray },{ alias: "binData", number: 5, order: 7, isType: null },{ alias: "objectId", number: 7, order: 8, isTypefnc: null },{ alias: "bool", number: 8, order: 9, isType: _.isBoolean },{ alias: "date", number: 9, order: 10, isTypefnc: _.isDate }, // format{ alias: "timestamp", number: 17, order: 11, isType: _.isDate }, // format{ alias: "regex", number: 11, order: 12, isType: _.isRegExp },{ alias: "maxKey", number: 127, order: 13, isType: null }// undefined 6// dbPointer// javascript// javascriptWithScope// function]

getByAlias

  • getByAlias(alias: any): any

getByValue

  • getByValue(val: any): any

_modifiers

_modifiers: object
ignore

$addToSet

  • $addToSet(target: any, field: any, arg: any): void

$bit

  • $bit(target: any, field: any, arg: any): void

$inc

  • $inc(target: any, field: any, arg: any): void

$pop

  • $pop(target: any, field: any, arg: any): void

$pull

  • $pull(target: any, field: any, arg: any): void

$pullAll

  • $pullAll(target: any, field: any, arg: any): void

$push

  • $push(target: any, field: any, arg: any): void

$pushAll

  • $pushAll(target: any, field: any, arg: any): void

$rename

  • $rename(target: any, field: any, value: any): void

$set

  • $set(target: any, field: any, arg: any): void

$unset

  • $unset(target: any, field: any, arg: any): void

group_operators

group_operators: object

$avg

  • $avg(documents: any, new_id: any, new_field: any, value: any, isCount: any): object

$sum

  • $sum(documents: any, new_id: any, new_field: any, value: any, isCount: any): object

stages

stages: object

$geoNear

$geoNear: boolean = false

$group

$group: boolean = true

$indexStats

$indexStats: boolean = false

$limit

$limit: boolean = false

$lookup

$lookup: boolean = false

$match

$match: boolean = true

$out

$out: boolean = false

$project

$project: boolean = true

$redact

$redact: boolean = false

$sample

$sample: boolean = false

$skip

$skip: boolean = false

$sort

$sort: boolean = true

$unwind

$unwind: boolean = false

Generated using TypeDoc