MongoDB Driver API for Node.js (original) (raw)

Node.js MongoDB Driver API Admin Typedefs resultCallback Methods addUser buildInfo command listDatabases ping removeUser replSetGetStatus serverInfo serverStatus validateCollection AggregationCursor Typedefs endCallback iteratorCallback resultCallback toArrayResultCallback Methods batchSize clone close each explain forEach geoNear group hasNext isClosed limit lookup match maxTimeMS next out pause pipe project read redact resume rewind setEncoding skip sort toArray unpipe unshift unwind wrap Events close data end readable AutoEncrypter Members logLevel Typedefs AutoEncryptionExtraOptions AutoEncryptionOptions logger Binary Members SUBTYPE_BYTE_ARRAY SUBTYPE_DEFAULT SUBTYPE_FUNCTION SUBTYPE_MD5 SUBTYPE_USER_DEFINED SUBTYPE_UUID SUBTYPE_UUID_OLD Methods length put read value write BSONRegExp BulkOperationBase Typedefs resultCallback Methods execute find insert raw BulkWriteError Members deletedCount errmsg insertedCount insertedIds matchedCount modifiedCount upsertedCount upsertedIds Methods hasErrorLabel BulkWriteResult Members deletedCount insertedCount insertedIds matchedCount modifiedCount nInserted nMatched nModified nRemoved nUpserted ok upsertedCount upsertedIds Methods getInsertedIds getLastOp getRawResponse getUpsertedIdAt getUpsertedIds getWriteConcernError getWriteErrorAt getWriteErrorCount getWriteErrors hasWriteErrors isOk toJSON toString ChangeStream Members resumeToken Typedefs resultCallback Methods close hasNext isClosed next pause pipe resume stream unpipe Events change close end error resumeTokenChanged ClientEncryption Typedefs createDataKeyCallback dataKeyId decryptCallback encryptCallback Methods createDataKey decrypt encrypt ClientSession Members id Methods abortTransaction advanceOperationTime commitTransaction endSession equals incrementTransactionNumber inTransaction startTransaction withTransaction Code Collection Members collectionName dbName hint namespace readConcern readPreference writeConcern Typedefs aggregationCallback bulkWriteOpCallback BulkWriteOpResult collectionResultCallback countCallback deleteWriteOpCallback deleteWriteOpResult findAndModifyCallback findAndModifyWriteOpResult IndexDefinition insertOneWriteOpCallback insertOneWriteOpResult insertWriteOpCallback insertWriteOpResult parallelCollectionScanCallback resultCallback updateWriteOpCallback updateWriteOpResult writeOpCallback WriteOpResult Methods aggregate bulkWrite count countDocuments createIndex createIndexes deleteMany deleteOne distinct drop dropAllIndexes dropIndex dropIndexes ensureIndex estimatedDocumentCount find findAndModify findAndRemove findOne findOneAndDelete findOneAndReplace findOneAndUpdate geoHaystackSearch group indexes indexExists indexInformation initializeOrderedBulkOp initializeUnorderedBulkOp insert insertMany insertOne isCapped listIndexes mapReduce options parallelCollectionScan reIndex remove rename replaceOne save stats update updateMany updateOne watch CommandCursor Typedefs endCallback iteratorCallback resultCallback toArrayResultCallback Methods batchSize clone close each hasNext isClosed maxTimeMS next pause pipe read resume rewind setEncoding setReadPreference toArray unpipe unshift wrap Events close data end readable Cursor Typedefs countResultCallback endCallback iteratorCallback resultCallback toArrayResultCallback Methods addCursorFlag addQueryModifier batchSize clone close collation comment count each explain filter forEach hasNext hint isClosed limit map max maxAwaitTimeMS maxScan maxTimeMS min next pause pipe project read resume returnKey rewind setCursorOption setEncoding setReadPreference showRecordId skip snapshot sort stream toArray transformStream unpipe unshift wrap Events close data end readable Db Members profilingInfo Typedefs collectionResultCallback Methods addUser admin aggregate collection collections command createCollection createIndex dropCollection dropDatabase ensureIndex eval executeDbAdminCommand indexInformation listCollections profilingLevel removeUser renameCollection setProfilingLevel stats unref watch Events close error fullsetup parseError reconnect timeout DBRef Decimal128 Methods toString fromString Double Methods valueOf FindOperators Methods delete deleteOne remove removeOne replaceOne update updateOne upsert GridFSBucket Typedefs errorCallback Methods delete drop find openDownloadStream openDownloadStreamByName openUploadStream openUploadStreamWithId rename Events index GridFSBucketReadStream Methods abort end pause pipe read resume setEncoding start unpipe unshift wrap Events close data end error file GridFSBucketWriteStream Methods abort end write Events error finish GridStore Members DEFAULT_CONTENT_TYPE DEFAULT_ROOT_COLLECTION IO_SEEK_CUR IO_SEEK_END IO_SEEK_SET Typedefs collectionCallback gridStoreCallback openCallback readCallback readlinesCallback resultCallback tellCallback Methods exist list read readlines unlink chunkCollection close collection destroy eof getc open puts read readlines rewind seek stream tell unlink write writeFile GridStoreStream Methods end pause pipe read resume setEncoding unpipe unshift wrap write Events close data drain end error finish pipe readable unpipe Int32 Methods valueOf Logger Typedefs loggerCallback Methods currentLogger filter reset setCurrentLogger setLevel debug error info isDebug isError isInfo isWarn Long Members MAX_VALUE MIN_VALUE NEG_ONE ONE ZERO Methods fromBigInt fromBits fromInt fromNumber fromString add and compare div equals getHighBits getLowBits getLowBitsUnsigned getNumBitsAbs greaterThan greaterThanOrEqual isNegative isOdd isZero lessThan lessThanOrEqual modulo multiply negate not notEquals or shiftLeft shiftRight shiftRightUnsigned subtract toBigInt toInt toJSON toNumber toString xor MaxKey MinKey MongoClient Typedefs connectCallback Methods connect close connect db isConnected startSession watch withSession MongoCryptError MongoError Members errmsg Methods create hasErrorLabel MongoNetworkError Members errmsg Methods hasErrorLabel MongoNetworkTimeoutError Members errmsg Methods hasErrorLabel MongoParseError Members errmsg Methods hasErrorLabel Mongos Events close commandFailed commandStarted commandSucceeded connect error fullsetup ha joined left open parseError timeout MongoServerSelectionError Members errmsg Methods hasErrorLabel MongoTimeoutError Members errmsg Methods hasErrorLabel MongoWriteConcernError Members errmsg Methods hasErrorLabel ObjectID Methods createFromHexString createFromTime isValid equals generate getTimestamp toHexString OrderedBulkOperation Methods execute find insert raw ReplSet Events close commandFailed commandStarted commandSucceeded connect error fullsetup ha joined left open parseError timeout Server Events close commandFailed commandStarted commandSucceeded connect error parseError reconnect timeout Symbol Methods valueOf Timestamp Members MAX_VALUE MIN_VALUE NEG_ONE ONE ZERO Methods fromBits fromInt fromNumber fromString add and compare div equals getHighBits getLowBits getLowBitsUnsigned getNumBitsAbs greaterThan greaterThanOrEqual isNegative isOdd isZero lessThan lessThanOrEqual modulo multiply negate not notEquals or shiftLeft shiftRight shiftRightUnsigned subtract toInt toJSON toNumber toString xor UnorderedBulkOperation Methods execute find insert raw WriteConcernError Members code errmsg Methods toJSON toString WriteError Members code errmsg index Methods getOperation toJSON toString Class: Timestamp Timestamp new Timestamp(low, high) node_modules/bson/lib/bson/timestamp.js, line 45 This type is for INTERNAL use in MongoDB only and should not be used in applications.The appropriate corresponding type is the JavaScript Date type. Defines a Timestamp class for representing a 64-bit two's-complementinteger value, which faithfully simulates the behavior of a Java "Timestamp". Thisimplementation is derived from TimestampLib in GWT. Constructs a 64-bit two's-complement integer, given its low and high 32-bitvalues as signed integers. See the from* functions below for moreconvenient ways of constructing Timestamps. The internal representation of a Timestamp is the two given signed, 32-bit values.We use 32-bit pieces because these are the size of integers on whichJavascript performs bit-operations. For operations like addition andmultiplication, we split each number into 16-bit pieces, which can easily bemultiplied within Javascript's floating-point representation without overflowor change in sign. In the algorithms below, we frequently reduce the negative case to thepositive case by negating the input(s) and then post-processing the result.Note that we must ALWAYS check specially whether those values are MIN_VALUE(-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented asa positive number, it overflows back into a negative). Not handling thiscase would often result in infinite recursion. Name Type Description low number the low (signed) 32 bits of the Timestamp. high number the high (signed) 32 bits of the Timestamp. Members staticTimestamp.MAX_VALUETimestamp staticTimestamp.MIN_VALUETimestamp staticTimestamp.NEG_ONETimestamp staticTimestamp.ONETimestamp staticTimestamp.ZEROTimestamp Methods staticTimestamp.fromBits(lowBits, highBits){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 725 Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. Name Type Description lowBits number the low 32-bits. highBits number the high 32-bits. Returns:corresponding Timestamp value. staticTimestamp.fromInt(value){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 678 Returns a Timestamp representing the given (32-bit) integer value. Name Type Description value number the 32-bit integer in question. Returns:corresponding Timestamp value. staticTimestamp.fromNumber(value){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 700 Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. Name Type Description value number the number in question. Returns:corresponding Timestamp value. staticTimestamp.fromString(str, opt_radix){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 737 Returns a Timestamp representation of the given string, written using the given radix. Name Type Description str string the textual representation of the Timestamp. opt_radix number the radix in which the text is written. Returns:corresponding Timestamp value. add(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 344 Returns the sum of this and the given Timestamp. Name Type Description other Timestamp Timestamp to add to this one. Returns:sum of this and the given Timestamp. and(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 577 Returns the bitwise-AND of this Timestamp and the given one. Name Type Description other Timestamp the Timestamp with which to AND. Returns:bitwise-AND of this and the other. compare(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 301 Compares this Timestamp with the given one. Name Type Description other Timestamp Timestamp to compare against. Returns:if they are the same, 1 if the this is greater, and -1 if the given one is greater. div(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 470 Returns this Timestamp divided by the given one. Name Type Description other Timestamp Timestamp by which to divide. Returns:Timestamp divided by the given one. equals(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 235 Return whether this Timestamp equals the other Name Type Description other Timestamp Timestamp to compare against. Returns:this Timestamp equals the other getHighBits(){number} node_modules/bson/lib/bson/timestamp.js, line 150 Return the high 32-bits value. Returns:high 32-bits as a signed value. getLowBits(){number} node_modules/bson/lib/bson/timestamp.js, line 160 Return the low 32-bits value. Returns:low 32-bits as a signed value. getLowBitsUnsigned(){number} node_modules/bson/lib/bson/timestamp.js, line 170 Return the low unsigned 32-bits value. Returns:low 32-bits as an unsigned value. getNumBitsAbs(){number} node_modules/bson/lib/bson/timestamp.js, line 180 Returns the number of bits needed to represent the absolute value of this Timestamp. Returns:the number of bits needed to represent the absolute value of this Timestamp. greaterThan(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 279 Return whether this Timestamp is greater than the other. Name Type Description other Timestamp Timestamp to compare against. Returns:this Timestamp is greater than the other. greaterThanOrEqual(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 290 Return whether this Timestamp is greater than or equal to the other. Name Type Description other Timestamp Timestamp to compare against. Returns:this Timestamp is greater than or equal to the other. isNegative(){boolean} node_modules/bson/lib/bson/timestamp.js, line 214 Return whether this value is negative. Returns:this value is negative. isOdd(){boolean} node_modules/bson/lib/bson/timestamp.js, line 224 Return whether this value is odd. Returns:this value is odd. isZero(){boolean} node_modules/bson/lib/bson/timestamp.js, line 204 Return whether this value is zero. Returns:this value is zero. lessThan(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 257 Return whether this Timestamp is less than the other. Name Type Description other Timestamp Timestamp to compare against. Returns:this Timestamp is less than the other. lessThanOrEqual(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 268 Return whether this Timestamp is less than or equal to the other. Name Type Description other Timestamp Timestamp to compare against. Returns:this Timestamp is less than or equal to the other. modulo(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 556 Returns this Timestamp modulo the given one. Name Type Description other Timestamp Timestamp by which to mod. Returns:Timestamp modulo the given one. multiply(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 393 Returns the product of this and the given Timestamp. Name Type Description other Timestamp Timestamp to multiply with this. Returns:product of this and the other. negate(){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 329 The negation of this value. Returns:negation of this value. not(){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 566 The bitwise-NOT of this value. Returns:bitwise-NOT of this value. notEquals(other){boolean} node_modules/bson/lib/bson/timestamp.js, line 246 Return whether this Timestamp does not equal the other. Name Type Description other Timestamp Timestamp to compare against. Returns:this Timestamp does not equal the other. or(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 588 Returns the bitwise-OR of this Timestamp and the given one. Name Type Description other Timestamp the Timestamp with which to OR. Returns:bitwise-OR of this and the other. shiftLeft(numBits){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 610 Returns this Timestamp with bits shifted to the left by the given amount. Name Type Description numBits number the number of bits by which to shift. Returns:shifted to the left by the given amount. shiftRight(numBits){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 632 Returns this Timestamp with bits shifted to the right by the given amount. Name Type Description numBits number the number of bits by which to shift. Returns:shifted to the right by the given amount. shiftRightUnsigned(numBits){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 654 Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. Name Type Description numBits number the number of bits by which to shift. Returns:shifted to the right by the given amount, with zeros placed into the new leading bits. subtract(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 382 Returns the difference of this and the given Timestamp. Name Type Description other Timestamp Timestamp to subtract from this. Returns:difference of this and the given Timestamp. toInt(){number} node_modules/bson/lib/bson/timestamp.js, line 66 Return the int value. Returns:value, assuming it is a 32-bit integer. toJSON(){string} node_modules/bson/lib/bson/timestamp.js, line 86 Return the JSON value. Returns:JSON representation. toNumber(){number} node_modules/bson/lib/bson/timestamp.js, line 76 Return the Number value. Returns:closest floating-point representation to this value. toString(opt_radix){string} node_modules/bson/lib/bson/timestamp.js, line 97 Return the String value. Name Type Description opt_radix number optional the radix in which the text should be written. Returns:textual representation of this value. xor(other){Timestamp} node_modules/bson/lib/bson/timestamp.js, line 599 Returns the bitwise-XOR of this Timestamp and the given one. Name Type Description other Timestamp the Timestamp with which to XOR. Returns:bitwise-XOR of this and the other.