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: Collection Collection new Collection() lib/collection.js, line 100 Create a new Collection instance (INTERNAL TYPE, do not instantiate directly) Members readonlycollectionNamestring The name of this collection readonlydbNamestring The name of the database this collection belongs to hintobject The current index hint for the collection readonlynamespacestring The namespace of this collection, in the format this.dbName.{this.dbName}.this.dbName.{this.collectionName} readonlyreadConcernReadConcern The current readConcern of the collection. If not explicitly defined forthis collection, will be inherited from the parent DB readonlyreadPreferenceReadPreference The current readPreference of the collection. If not explicitly defined forthis collection, will be inherited from the parent DB readonlywriteConcernWriteConcern The current writeConcern of the collection. If not explicitly defined forthis collection, will be inherited from the parent DB Methods aggregate(pipeline, options, callback){null|AggregationCursor} lib/collection.js, line 1910 Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2 Name Type Default Description pipeline object [] optional Array containing all the aggregation framework commands for the execution. options object optional Optional settings. Name Type Default Description readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). batchSize number 1000 optional The number of documents to return per batch. See aggregation documentation. cursor object optional Return the query as cursor, on 2.6 > it returns as a real cursor on pre 2.6 it returns as an emulated cursor. Name Type Default Description batchSize number 1000 optional Deprecated. Use options.batchSize allowDiskUse boolean false optional allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 >). maxTimeMS number optional maxTimeMS specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point. maxAwaitTimeMS number optional The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. raw boolean false optional Return document results as raw BSON buffers. promoteLongs boolean true optional Promotes Long values to number if they fit inside the 53 bits resolution. promoteValues boolean true optional Promotes BSON values to native types where possible, set to false to only receive wrapper types. promoteBuffers boolean false optional Promotes Binary BSON values to native Node Buffers. collation object optional Specify collation settings for operation. See aggregation documentation. comment string optional Add a comment to an aggregation command hint string|object optional Add an index selection hint to an aggregation command explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~aggregationCallback The command result callback bulkWrite(operations, options, callback){Promise} lib/collection.js, line 612 Perform a bulkWrite operation without a fluent API Legal operation types are { insertOne: { document: { a: 1 } } } { updateOne: { filter: {a:2}, update: {$set: {a:2}}, upsert:true } } { updateMany: { filter: {a:2}, update: {$set: {a:2}}, upsert:true } } { updateMany: { filter: {}, update: {$set: {"a.$[i].x": 5}}, arrayFilters: [{ "i.x": 5 }]} } { deleteOne: { filter: {c:1} } } { deleteMany: { filter: {c:1} } } { replaceOne: { filter: {c:3}, replacement: {c:4}, upsert:true}} If documents passed in do not contain the _id field,one will be added to each of the documents missing it by the driver, mutating the document. This behaviorcan be overridden by setting the forceServerObjectId flag. Name Type Description operations Array. Bulk operations to perform. options object optional Optional settings. Name Type Default Description ordered boolean true optional Execute write operation in ordered or unordered fashion. bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. arrayFilters Array. optional Determines which array elements to modify for update operation in MongoDB 3.6 or higher. w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. session ClientSession optional optional session to use for this operation callback Collection~bulkWriteOpCallback optional The command result callback Returns:Promise if no callback passed count(query, options, callback){Promise} lib/collection.js, line 1516 An estimated count of matching documents in the db to a query. NOTE: This method has been deprecated, since it does not provide an accurate count of the documentsin a collection. To obtain an accurate count of documents in the collection, use countDocuments.To obtain an estimated count of all documents in the collection, use estimatedDocumentCount. Name Type Default Description query object {} optional The query for the count. options object optional Optional settings. Name Type Description collation object optional Specify collation settings for operation. See aggregation documentation. limit boolean optional The limit of documents to count. skip boolean optional The number of documents to skip for the count. hint string optional An index name hint for the query. readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). maxTimeMS number optional Number of milliseconds to wait before aborting the query. session ClientSession optional optional session to use for this operation callback Collection~countCallback optional The command result callback Deprecateduse countDocuments or estimatedDocumentCount instead Returns:Promise if no callback passed countDocuments(query, options, callback){Promise} lib/collection.js, line 1583 Gets the number of documents matching the filter.For a fast count of the total documents in a collection see estimatedDocumentCount. Note: When migrating from count to countDocumentsthe following query operators must be replaced: Operator Replacement where[where [whereexpr near[near [neargeoWithin with $center nearSphere[nearSphere [nearSpheregeoWithin with $centerSphere Name Type Description query object optional the query for the count options object optional Optional settings. Name Type Description collation object optional Specifies a collation. hint string|object optional The index to use. limit number optional The maximum number of document to count. maxTimeMS number optional The maximum amount of time to allow the operation to run. skip number optional The number of documents to skip before counting. callback Collection~countCallback optional The command result callback. See: https://www.mongodb.com/docs/manual/reference/operator/query/expr/ https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/ https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere Returns:Promise if no callback passed. createIndex(fieldOrSpec, options, callback){Promise} lib/collection.js, line 1243 Creates an index on the db and collection collection. Name Type Description fieldOrSpec string|array|object Defines the index. options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. unique boolean false optional Creates an unique index. sparse boolean false optional Creates a sparse index. background boolean false optional Creates the index in the background, yielding whenever possible. dropDups boolean false optional A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value min number optional For geospatial indexes set the lower bound for the co-ordinates. max number optional For geospatial indexes set the high bound for the co-ordinates. v number optional Specify the format version of the indexes. expireAfterSeconds number optional Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) name string optional Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) partialFilterExpression object optional Creates a partial index based on the given filter object (MongoDB 3.2 or higher) collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). session ClientSession optional optional session to use for this operation commitQuorum number|string optional (MongoDB 4.4. or higher) Specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready. This option accepts the same values for the "w" field in a write concern plus "votingMembers", which indicates all voting data-bearing nodes. callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed Example const collection = client.db('foo').collection('bar'); await collection.createIndex({ a: 1, b: -1 }); // Alternate syntax for { c: 1, d: -1 } that ensures order of indexes await collection.createIndex([ [c, 1], [d, -1] ]); // Equivalent to { e: 1 } await collection.createIndex('e'); // Equivalent to { f: 1, g: 1 } await collection.createIndex(['f', 'g']) // Equivalent to { h: 1, i: -1 } await collection.createIndex([ { h: 1 }, { i: -1 } ]); // Equivalent to { j: 1, k: -1, l: 2d } await collection.createIndex(['j', ['k', -1], { l: '2d' }]) createIndexes(indexSpecs, options, callback){Promise} lib/collection.js, line 1296 Creates multiple indexes in the collection, this method is only supported forMongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supportederror. Note: Unlike createIndex, this function takes in raw index specifications.Index specifications are defined here. Name Type Description indexSpecs Array.<Collection~IndexDefinition> An array of index specifications to be created options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation commitQuorum number|string optional (MongoDB 4.4. or higher) Specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready. This option accepts the same values for the "w" field in a write concern plus "votingMembers", which indicates all voting data-bearing nodes. callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed Example const collection = client.db('foo').collection('bar'); await collection.createIndexes([ // Simple index on field fizz { key: { fizz: 1 }, } // wildcard index { key: { '$**': 1 } }, // named index on darmok and jalad { key: { darmok: 1, jalad: -1 } name: 'tanagra' } ]); deleteMany(filter, options, callback){Promise} lib/collection.js, line 960 Delete multiple documents from a collection Name Type Description filter object The Filter used to select the documents to remove options object optional Optional settings. Name Type Default Description collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation hint string|object optional optional index hint for optimizing the filter query callback Collection~deleteWriteOpCallback optional The command result callback Returns:Promise if no callback passed deleteOne(filter, options, callback){Promise} lib/collection.js, line 924 Delete a document from a collection Name Type Description filter object The Filter used to select the document to remove options object optional Optional settings. Name Type Default Description collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation hint string|object optional optional index hint for optimizing the filter query callback Collection~deleteWriteOpCallback optional The command result callback Returns:Promise if no callback passed distinct(key, query, options, callback){Promise} lib/collection.js, line 1608 The distinct command returns a list of distinct values for the given key across a collection. Name Type Description key string Field of the document to find distinct values for. query object optional The query for filtering the set of documents to which we apply the distinct filter. options object optional Optional settings. Name Type Description readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). maxTimeMS number optional Number of milliseconds to wait before aborting the query. collation object optional Specify collation settings for operation. See aggregation documentation. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed drop(options, callback){Promise} lib/collection.js, line 1150 Drop the collection from the database, removing it permanently. New accesses will create a new collection. Name Type Description options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The results callback Returns:Promise if no callback passed dropAllIndexes(callback){Promise} lib/collection.js, line 1367 Drops all indexes from this collection. Name Type Description callback Collection~resultCallback The command result callback Deprecateduse dropIndexes Returns:Promise if no [callback] passed dropIndex(indexName, options, callback){Promise} lib/collection.js, line 1327 Drops an index from this collection. Name Type Description indexName string Name of the index to drop. options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. session ClientSession optional optional session to use for this operation maxTimeMS number optional Number of milliseconds to wait before aborting the query. callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed dropIndexes(options, callback){Promise} lib/collection.js, line 1349 Drops all indexes from this collection. Name Type Description options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation maxTimeMS number optional Number of milliseconds to wait before aborting the query. callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed ensureIndex(fieldOrSpec, options, callback){Promise} lib/collection.js, line 1435 Ensures that an index exists, if it does not it creates it Name Type Description fieldOrSpec string|object Defines the index. options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. unique boolean false optional Creates an unique index. sparse boolean false optional Creates a sparse index. background boolean false optional Creates the index in the background, yielding whenever possible. dropDups boolean false optional A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value min number optional For geospatial indexes set the lower bound for the co-ordinates. max number optional For geospatial indexes set the high bound for the co-ordinates. v number optional Specify the format version of the indexes. expireAfterSeconds number optional Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) name number optional Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Deprecateduse createIndexes instead Returns:Promise if no callback passed estimatedDocumentCount(options, callback){Promise} lib/collection.js, line 1542 Gets an estimate of the count of documents in a collection using collection metadata. Name Type Description options object optional Optional settings. Name Type Description maxTimeMS number optional The maximum amount of time to allow the operation to run. callback Collection~countCallback optional The command result callback. Returns:Promise if no callback passed. find(query, options){Cursor} lib/collection.js, line 318 Creates a cursor for a query that can be used to iterate over results from MongoDB Name Type Default Description query object {} optional The cursor query object. options object optional Optional settings. Name Type Default Description limit number 0 optional Sets the limit of documents returned in the query. sort array|object optional Set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. projection object optional The fields to return in the query. Object of fields to either include or exclude (one of, not both), {'a':1, 'b': 1} or {'a': 0, 'b': 0} fields object optional Deprecated Use options.projection instead skip number 0 optional Set to skip N documents ahead in your query (useful for pagination). hint Object optional Tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} snapshot boolean false optional DEPRECATED: Snapshot query. timeout boolean false optional Specify if the cursor can timeout. tailable boolean false optional Specify if the cursor is tailable. awaitData boolean false optional Specify if the cursor is a a tailable-await cursor. Requires tailable to be true batchSize number 1000 optional Set the batchSize for the getMoreCommand when iterating over the query results. returnKey boolean false optional Only return the index key. maxScan number optional DEPRECATED: Limit the number of items to scan. min number optional Set index bounds. max number optional Set index bounds. showDiskLoc boolean false optional Show disk location of results. comment string optional You can put a commentfieldonaquerytomakelookingintheprofilerlogssimpler.rawbooleanfalseoptionalReturndocumentresultsasrawBSONbuffers.promoteLongsbooleantrueoptionalPromotesLongvaluestonumberiftheyfitinsidethe53bitsresolution.promoteValuesbooleantrueoptionalPromotesBSONvaluestonativetypeswherepossible,settofalsetoonlyreceivewrappertypes.promoteBuffersbooleanfalseoptionalPromotesBinaryBSONvaluestonativeNodeBuffers.readPreferenceReadPreference∣stringoptionalThepreferredreadpreference(ReadPreference.PRIMARY,ReadPreference.PRIMARYPREFERRED,ReadPreference.SECONDARY,ReadPreference.SECONDARYPREFERRED,ReadPreference.NEAREST).partialbooleanfalseoptionalSpecifyifthecursorshouldreturnpartialresultswhenqueryingagainstashardedsystemmaxTimeMSnumberoptionalNumberofmillisecondstowaitbeforeabortingthequery.maxAwaitTimeMSnumberoptionalThemaximumamountoftimefortheservertowaitonnewdocumentstosatisfyatailablecursorquery.RequirestailableandawaitDatatobetruenoCursorTimeoutbooleanoptionalTheservernormallytimesoutidlecursorsafteraninactivityperiod(10minutes)topreventexcessmemoryuse.Setthisoptiontopreventthat.collationobjectoptionalSpecifycollation(MongoDB3.4orhigher)settingsforupdateoperation(see3.4documentationforavailablefields).allowDiskUsebooleanoptionalEnableswritingtotemporaryfilesontheserver.explain′queryPlanner′∣′queryPlannerExtended′∣′executionStats′∣′allPlansExecution′∣booleanoptionalTheverbositymodefortheexplainoutput.session[ClientSession](ClientSession.html)optionaloptionalsessiontouseforthisoperationThrows:[MongoError](MongoError.html)findAndModify(query,sort,doc,options,callback)Promise[lib/collection.js](libcomment field on a query to make looking in the profiler logs simpler. raw boolean false optional Return document results as raw BSON buffers. promoteLongs boolean true optional Promotes Long values to number if they fit inside the 53 bits resolution. promoteValues boolean true optional Promotes BSON values to native types where possible, set to false to only receive wrapper types. promoteBuffers boolean false optional Promotes Binary BSON values to native Node Buffers. readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). partial boolean false optional Specify if the cursor should return partial results when querying against a sharded system maxTimeMS number optional Number of milliseconds to wait before aborting the query. maxAwaitTimeMS number optional The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. Requires tailable and awaitData to be true noCursorTimeout boolean optional The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). allowDiskUse boolean optional Enables writing to temporary files on the server. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation Throws: MongoError findAndModify(query, sort, doc, options, callback){Promise} lib/collection.js, line 1824 Find and update a document. Name Type Description query object Query object to locate the object to modify. sort array If multiple docs match, choose the first one in the specified sort order as the object to manipulate. doc object The fields/vals to be updated. options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. remove boolean false optional Set to true to remove the object before returning. upsert boolean false optional Perform an upsert operation. new boolean false optional Set to true if you want to return the modified object rather than the original. Ignored for remove. projection object optional Object containing the field projection for the result returned from the operation. fields object optional Deprecated Use options.projection instead session ClientSession optional optional session to use for this operation arrayFilters Array optional optional list of array filters referenced in filtered positional operators callback Collection~findAndModifyCallback optional The command result callback Deprecateduse findOneAndUpdate, findOneAndReplace or findOneAndDelete instead Returns:Promise if no callback passed findAndRemove(query, sort, options, callback){Promise} lib/collection.js, line 1869 Find and remove a document. Name Type Description query object Query object to locate the object to modify. sort array If multiple docs match, choose the first one in the specified sort order as the object to manipulate. options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Deprecateduse findOneAndDelete instead Returns:Promise if no callback passed findOne(query, options, callback){Promise} lib/collection.js, line 1087 Fetches the first document that matches the query Name Type Description query object Query for find Operation options object optional Optional settings. Name Type Default Description limit number 0 optional Sets the limit of documents returned in the query. sort array|object optional Set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. projection object optional The fields to return in the query. Object of fields to include or exclude (not both), {'a':1} fields object optional Deprecated Use options.projection instead skip number 0 optional Set to skip N documents ahead in your query (useful for pagination). hint Object optional Tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} snapshot boolean false optional DEPRECATED: Snapshot query. timeout boolean false optional Specify if the cursor can timeout. tailable boolean false optional Specify if the cursor is tailable. batchSize number 1 optional Set the batchSize for the getMoreCommand when iterating over the query results. returnKey boolean false optional Only return the index key. maxScan number optional DEPRECATED: Limit the number of items to scan. min number optional Set index bounds. max number optional Set index bounds. showDiskLoc boolean false optional Show disk location of results. comment string optional You can put a commentfieldonaquerytomakelookingintheprofilerlogssimpler.rawbooleanfalseoptionalReturndocumentresultsasrawBSONbuffers.promoteLongsbooleantrueoptionalPromotesLongvaluestonumberiftheyfitinsidethe53bitsresolution.promoteValuesbooleantrueoptionalPromotesBSONvaluestonativetypeswherepossible,settofalsetoonlyreceivewrappertypes.promoteBuffersbooleanfalseoptionalPromotesBinaryBSONvaluestonativeNodeBuffers.readPreferenceReadPreference∣stringoptionalThepreferredreadpreference(ReadPreference.PRIMARY,ReadPreference.PRIMARYPREFERRED,ReadPreference.SECONDARY,ReadPreference.SECONDARYPREFERRED,ReadPreference.NEAREST).partialbooleanfalseoptionalSpecifyifthecursorshouldreturnpartialresultswhenqueryingagainstashardedsystemmaxTimeMSnumberoptionalNumberofmillisecondstowaitbeforeabortingthequery.maxAwaitTimeMSnumberoptionalThemaximumamountoftimefortheservertowaitonnewdocumentstosatisfyatailablecursorquery.RequirestailableandawaitDatatobetruenoCursorTimeoutbooleanoptionalTheservernormallytimesoutidlecursorsafteraninactivityperiod(10minutes)topreventexcessmemoryuse.Setthisoptiontopreventthat.collationobjectoptionalSpecifycollation(MongoDB3.4orhigher)settingsforupdateoperation(see3.4documentationforavailablefields).allowDiskUsebooleanoptionalEnableswritingtotemporaryfilesontheserver.explain′queryPlanner′∣′queryPlannerExtended′∣′executionStats′∣′allPlansExecution′∣booleanoptionalTheverbositymodefortheexplainoutput.session[ClientSession](ClientSession.html)optionaloptionalsessiontouseforthisoperationThrows:[MongoError](MongoError.html)findAndModify(query,sort,doc,options,callback)Promise[lib/collection.js](libcomment field on a query to make looking in the profiler logs simpler. raw boolean false optional Return document results as raw BSON buffers. promoteLongs boolean true optional Promotes Long values to number if they fit inside the 53 bits resolution. promoteValues boolean true optional Promotes BSON values to native types where possible, set to false to only receive wrapper types. promoteBuffers boolean false optional Promotes Binary BSON values to native Node Buffers. readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). partial boolean false optional Specify if the cursor should return partial results when querying against a sharded system maxTimeMS number optional Number of milliseconds to wait before aborting the query. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed findOneAndDelete(filter, options, callback){Promise.<Collection~findAndModifyWriteOpResultObject>} lib/collection.js, line 1688 Find a document and delete it in one atomic operation. Requires a write lock for the duration of the operation. Name Type Description filter object The Filter used to select the document to remove options object optional Optional settings. Name Type Default Description collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). projection object optional Limits the fields to return for all matching documents. sort object optional Determines which document the operation modifies if the query selects multiple documents. maxTimeMS number optional The maximum amount of time to allow the query to run. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~findAndModifyCallback optional The collection result callback Returns:Promise if no callback passed findOneAndReplace(filter, replacement, options, callback){Promise.<Collection~findAndModifyWriteOpResultObject>} lib/collection.js, line 1729 Find a document and replace it in one atomic operation. Requires a write lock for the duration of the operation. Name Type Description filter object The Filter used to select the document to replace replacement object The Document that replaces the matching document options object optional Optional settings. Name Type Default Description bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). hint string|object optional An optional index to use for this operation maxTimeMS number optional The maximum amount of time to allow the query to run. projection object optional Limits the fields to return for all matching documents. sort object optional Determines which document the operation modifies if the query selects multiple documents. upsert boolean false optional Upsert the document if it does not exist. returnDocument 'before'|'after' 'before' optional When set to 'after', returns the updated document rather than the original. The default is 'before'. returnOriginal boolean true optional Deprecated Use options.returnDocument instead. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~findAndModifyCallback optional The collection result callback Returns:Promise if no callback passed findOneAndUpdate(filter, update, options, callback){Promise.<Collection~findAndModifyWriteOpResultObject>} lib/collection.js, line 1778 Find a document and update it in one atomic operation. Requires a write lock for the duration of the operation. Name Type Description filter object The Filter used to select the document to update update object Update operations to be performed on the document options object optional Optional settings. Name Type Default Description arrayFilters Array optional optional list of array filters referenced in filtered positional operators bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). hint string|object optional An optional index to use for this operation maxTimeMS number optional The maximum amount of time to allow the query to run. projection object optional Limits the fields to return for all matching documents. sort object optional Determines which document the operation modifies if the query selects multiple documents. upsert boolean false optional Upsert the document if it does not exist. returnDocument 'before'|'after' 'before' optional When set to 'after', returns the updated document rather than the original. The default is 'before'. returnOriginal boolean true optional Deprecated Use options.returnDocument instead. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional An ptional session to use for this operation callback Collection~findAndModifyCallback optional The collection result callback Returns:Promise if no callback passed geoHaystackSearch(x, y, options, callback){Promise} lib/collection.js, line 2050 Execute a geo search using a geo haystack index on a collection. Name Type Description x number Point to search on the x axis, ensure the indexes are ordered in the same order. y number Point to search on the y axis, ensure the indexes are ordered in the same order. options object optional Optional settings. Name Type Default Description readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). maxDistance number optional Include results up to maxDistance from the point. search object optional Filter the results by a query. limit number false optional Max number of results to return. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback DeprecatedSee geospatial queries docs for current geospatial support Returns:Promise if no callback passed group(keys, condition, initial, reduce, finalize, command, options, callback){Promise} lib/collection.js, line 2077 Run a group command across a collection Name Type Description keys object|array|function|code An object, array or function expressing the keys to group by. condition object An optional condition that must be true for a row to be considered. initial object Initial value of the aggregation counter object. reduce function|Code The reduce function aggregates (reduces) the objects iterated finalize function|Code An optional function to be run on each item in the result set just before the item is returned. command boolean Specify if you wish to run using the internal group command or using eval, default is true. options object optional Optional settings. Name Type Description readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback DeprecatedMongoDB 3.6 or higher no longer supports the group command. We recommend rewriting using the aggregation framework. Returns:Promise if no callback passed indexes(options, callback){Promise} lib/collection.js, line 1627 Retrieve all the indexes on the collection. Name Type Description options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed indexExists(indexes, options, callback){Promise} lib/collection.js, line 1456 Checks if one or more indexes exist on the collection, fails on first non-existing index Name Type Description indexes string|array One or more index names to check. options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed indexInformation(options, callback){Promise} lib/collection.js, line 1474 Retrieves this collections index info. Name Type Description options object optional Optional settings. Name Type Default Description full boolean false optional Returns the full raw index information. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Returns:Promise if no callback passed initializeOrderedBulkOp(options){null} lib/collection.js, line 2220 Initiate an In order bulk write operation. Operations will be serially executed in the order they are added, creating a new operation for each switch in types. Name Type Description options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. session ClientSession optional optional session to use for this operation ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. initializeUnorderedBulkOp(options){UnorderedBulkOperation} lib/collection.js, line 2196 Initiate an Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order. Name Type Description options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. session ClientSession optional optional session to use for this operation insert(docs, options, callback){Promise} lib/collection.js, line 695 Inserts a single document or a an array of documents into MongoDB. If documents passed in do not contain the _id field,one will be added to each of the documents missing it by the driver, mutating the document. This behaviorcan be overridden by setting the forceServerObjectId flag. Name Type Description docs object|Array. Documents to insert. options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. serializeFunctions boolean false optional Serialize functions on any object. forceServerObjectId boolean false optional Force server to assign _id values instead of driver. bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. session ClientSession optional optional session to use for this operation callback Collection~insertWriteOpCallback optional The command result callback DeprecatedUse insertOne, insertMany or bulkWrite Returns:Promise if no callback passed insertMany(docs, options, callback){Promise} lib/collection.js, line 544 Inserts an array of documents into MongoDB. If documents passed in do not contain the _id field,one will be added to each of the documents missing it by the driver, mutating the document. This behaviorcan be overridden by setting the forceServerObjectId flag. Name Type Description docs Array. Documents to insert. options object optional Optional settings. Name Type Default Description bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. ordered boolean true optional If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails. forceServerObjectId boolean false optional Force server to assign _id values instead of driver. w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean true optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. session ClientSession optional optional session to use for this operation callback Collection~insertWriteOpCallback optional The command result callback Returns:Promise if no callback passed insertOne(doc, options, callback){Promise} lib/collection.js, line 507 Inserts a single document into MongoDB. If documents passed in do not contain the _id field,one will be added to each of the documents missing it by the driver, mutating the document. This behaviorcan be overridden by setting the forceServerObjectId flag. Name Type Description doc object Document to insert. options object optional Optional settings. Name Type Default Description bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. forceServerObjectId boolean false optional Force server to assign _id values instead of driver. w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean true optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. session ClientSession optional optional session to use for this operation callback Collection~insertOneWriteOpCallback optional The command result callback Returns:Promise if no callback passed isCapped(options, callback){Promise} lib/collection.js, line 1190 Returns if the collection is a capped collection Name Type Description options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The results callback Returns:Promise if no callback passed listIndexes(options){CommandCursor} lib/collection.js, line 1401 Get the list of all indexes information for the collection. Name Type Description options object optional Optional settings. Name Type Default Description batchSize number 1000 optional The batchSize for the returned command cursor or if pre 2.8 the systems batch collection readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). session ClientSession optional optional session to use for this operation mapReduce(map, reduce, options, callback){Promise} lib/collection.js, line 2158 Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection. Name Type Description map function|string The mapping function. reduce function|string The reduce function. options object optional Optional settings. Name Type Default Description readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). out object optional Sets the output target for the map reduce job. {inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'} query object optional Query filter object. sort object optional Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. limit number optional Number of objects to return from collection. keeptemp boolean false optional Keep temporary data. finalize function|string optional Finalize function. scope object optional Can pass in variables that can be access from map/reduce/finalize. jsMode boolean false optional It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X. verbose boolean false optional Provide statistics on job execution time. bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Throws: MongoError Returns:Promise if no callback passed options(options, callback){Promise} lib/collection.js, line 1172 Returns the options of the collection. Name Type Description options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The results callback Returns:Promise if no callback passed parallelCollectionScan(options, callback){Promise} lib/collection.js, line 2009 Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There areno ordering guarantees for returned results. Name Type Description options object optional Optional settings. Name Type Default Description readPreference ReadPreference|string optional The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). batchSize number 1000 optional Set the batchSize for the getMoreCommand when iterating over the query results. numCursors number 1 optional The maximum number of parallel command cursors to return (the number of returned cursors will be in the range 1:numCursors) raw boolean false optional Return all BSON documents as Raw Buffer documents. callback Collection~parallelCollectionScanCallback optional The command result callback Returns:Promise if no callback passed reIndex(options, callback){Promise} lib/collection.js, line 1382 Reindex all indexes on the collectionWarning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. Name Type Description options Object optional Optional settings Name Type Description session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The command result callback Deprecateduse db.command instead Returns:Promise if no callback passed remove(selector, options, callback){Promise} lib/collection.js, line 993 Remove documents. Name Type Description selector object The selector for the update operation. options object optional Optional settings. Name Type Default Description collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. single boolean false optional Removes the first document found. session ClientSession optional optional session to use for this operation callback Collection~writeOpCallback optional The command result callback Deprecateduse deleteOne, deleteMany or bulkWrite Returns:Promise if no callback passed rename(newName, options, callback){Promise} lib/collection.js, line 1128 Rename the collection. Name Type Description newName string New name of of the collection. options object optional Optional settings. Name Type Default Description dropTarget boolean false optional Drop the target name collection if it previously exists. session ClientSession optional optional session to use for this operation callback Collection~collectionResultCallback optional The results callback Returns:Promise if no callback passed replaceOne(filter, doc, options, callback){Promise.<Collection~updateWriteOpResult>} lib/collection.js, line 791 Replace a document in a collection with another document Name Type Description filter object The Filter used to select the document to replace doc object The Document that replaces the matching document options object optional Optional settings. Name Type Default Description bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). hint object optional An optional hint for query optimization. See the update command reference for more information. upsert boolean false optional When true, creates a new document if no document matches the query. w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. session ClientSession optional optional session to use for this operation callback Collection~updateWriteOpCallback optional The command result callback Returns:Promise if no callback passed save(doc, options, callback){Promise} lib/collection.js, line 1026 Save a document. Simple full document replacement function. Not recommended for efficiency, use atomicoperators and update instead for more efficient operations. Name Type Description doc object Document to save options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. session ClientSession optional optional session to use for this operation callback Collection~writeOpCallback optional The command result callback Deprecateduse insertOne, insertMany, updateOne or updateMany Returns:Promise if no callback passed stats(options, callback){Promise} lib/collection.js, line 1646 Get all the collection statistics. Name Type Description options object optional Optional settings. Name Type Description scale number optional Divide the returned sizes by scale value. session ClientSession optional optional session to use for this operation callback Collection~resultCallback optional The collection result callback Returns:Promise if no callback passed update(selector, update, options, callback){Promise} lib/collection.js, line 870 Updates documents. Name Type Description selector object The selector for the update operation. update object The update operations to be applied to the documents options object optional Optional settings. Name Type Default Description w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. upsert boolean false optional Update operation is an upsert. multi boolean false optional Update one/all documents with operation. bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). arrayFilters Array optional optional list of array filters referenced in filtered positional operators session ClientSession optional optional session to use for this operation hint object optional An optional hint for query optimization. See the update command reference for more information. callback Collection~writeOpCallback optional The command result callback Deprecateduse updateOne, updateMany or bulkWrite Throws: MongoError Returns:Promise if no callback passed updateMany(filter, update, options, callback){Promise.<Collection~updateWriteOpResult>} lib/collection.js, line 831 Update multiple documents in a collection Name Type Description filter object The Filter used to select the documents to update update object The update operations to be applied to the documents options object optional Optional settings. Name Type Default Description arrayFilters Array optional optional list of array filters referenced in filtered positional operators bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). hint object optional An optional hint for query optimization. See the update command reference for more information. upsert boolean false optional When true, creates a new document if no document matches the query.. w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~updateWriteOpCallback optional The command result callback Returns:Promise if no callback passed updateOne(filter, update, options, callback){Promise} lib/collection.js, line 753 Update a single document in a collection Name Type Description filter object The Filter used to select the document to update update object The update operations to be applied to the document options object optional Optional settings. Name Type Default Description arrayFilters Array optional optional list of array filters referenced in filtered positional operators bypassDocumentValidation boolean false optional Allow driver to bypass schema validation in MongoDB 3.2 or higher. collation object optional Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields). hint object optional An optional hint for query optimization. See the update command reference for more information. upsert boolean false optional When true, creates a new document if no document matches the query.. w number|string optional Deprecated The write concern. Use writeConcern instead. wtimeout number optional Deprecated The write concern timeout. Use writeConcern instead. j boolean false optional Deprecated Specify a journal write concern. Use writeConcern instead. writeConcern object|WriteConcern optional Specify write concern settings. checkKeys boolean false optional If true, will throw if bson documents start with $ or include a . in any key value serializeFunctions boolean false optional Serialize functions on any object. ignoreUndefined boolean false optional Specify if the BSON serializer should ignore undefined fields. explain 'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean optional The verbosity mode for the explain output. session ClientSession optional optional session to use for this operation callback Collection~updateWriteOpCallback optional The command result callback Returns:Promise if no callback passed watch(pipeline, options){ChangeStream} lib/collection.js, line 1977 Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection. Name Type Description pipeline Array optional An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents. options object optional Optional settings Name Type Default Description fullDocument string 'default' optional Allowed values: ‘default’, ‘updateLookup’. When set to ‘updateLookup’, the change stream will include both a delta describing the changes to the document, as well as a copy of the entire document that was changed from some time after the change occurred. resumeAfter object optional Specifies the logical starting point for the new change stream. This should be the _id field from a previously returned change stream document. maxAwaitTimeMS number optional The maximum amount of time for the server to wait on new documents to satisfy a change stream query batchSize number 1000 optional The number of documents to return per batch. See aggregation documentation. collation object optional Specify collation settings for operation. See aggregation documentation. readPreference ReadPreference optional The read preference. Defaults to the read preference of the database or collection. See read preference documentation. startAtOperationTime Timestamp optional receive change events that occur after the specified timestamp session ClientSession optional optional session to use for this operation Since: 3.0.0 Returns:ChangeStream instance. Type Definitions aggregationCallback(error, cursor) lib/collection.js, line 1046 The callback format for an aggregation call Name Type Description error MongoError An error instance representing the error during the execution. cursor AggregationCursor The cursor if the aggregation command was executed successfully. bulkWriteOpCallback(error, result) lib/collection.js, line 565 The callback format for inserts Name Type Description error BulkWriteError An error instance representing the error during the execution. result Collection~BulkWriteOpResult The result object if the command was executed successfully. BulkWriteOpResultObject Properties: Name Type Description insertedCount number Number of documents inserted. matchedCount number Number of documents matched for update. modifiedCount number Number of documents modified. deletedCount number Number of documents deleted. upsertedCount number Number of documents upserted. insertedIds object Inserted document generated Id's, hash key is the index of the originating operation upsertedIds object Upserted document generated Id's, hash key is the index of the originating operation result object The command result object. collectionResultCallback(error, collection) lib/collection.js, line 1110 The callback format for the collection method, must be used if strict is specified Name Type Description error MongoError An error instance representing the error during the execution. collection Collection The collection instance. countCallback(error, result) lib/collection.js, line 1488 The callback format for results Name Type Description error MongoError An error instance representing the error during the execution. result number The count of documents that matched the query. deleteWriteOpCallback(error, result) lib/collection.js, line 898 The callback format for deletes Name Type Description error MongoError An error instance representing the error during the execution. result Collection~deleteWriteOpResult The result object if the command was executed successfully. deleteWriteOpResultObject Properties: Name Type Description result Object The raw result returned from MongoDB. Will vary depending on server version. Properties Name Type Description ok Number Is 1 if the command executed correctly. n Number The total count of documents deleted. connection Object The connection object used for the operation. deletedCount Number The number of documents deleted. findAndModifyCallback(error, result) lib/collection.js, line 1663 The callback format for inserts Name Type Description error MongoError An error instance representing the error during the execution. result Collection~findAndModifyWriteOpResult The result object if the command was executed successfully. findAndModifyWriteOpResultObject Properties: Name Type Description value object Document returned from the findAndModify command. If no documents were found, value will be null by default even if a document was upserted unless returnDocument is specified as 'after', in which case the upserted document will be returned. lastErrorObject object The raw lastErrorObject returned from the command. See findAndModify command documentation. ok Number Is 1 if the command executed correctly. IndexDefinitionobject A definition for an index. Used by the createIndex command. See: https://www.mongodb.com/docs/manual/reference/command/createIndexes/ insertOneWriteOpCallback(error, result) lib/collection.js, line 668 The callback format for inserts Name Type Description error MongoError An error instance representing the error during the execution. result Collection~insertOneWriteOpResult The result object if the command was executed successfully. insertOneWriteOpResultObject Properties: Name Type Description insertedCount number The total amount of documents inserted. ops Array. All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany insertedId ObjectId The driver generated ObjectId for the insert operation. connection object The connection object used for the operation. result object The raw command result object returned from MongoDB (content might vary by server version). Properties Name Type Description ok number Is 1 if the command executed correctly. n number The total count of documents inserted. insertWriteOpCallback(error, result) lib/collection.js, line 661 The callback format for inserts Name Type Description error MongoError An error instance representing the error during the execution. result Collection~insertWriteOpResult The result object if the command was executed successfully. insertWriteOpResultObject Properties: Name Type Description insertedCount number The total amount of documents inserted. ops Array. All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany insertedIds Object.<Number, ObjectId> Map of the index of the inserted document to the id of the inserted document. connection object The connection object used for the operation. result object The raw command result object returned from MongoDB (content might vary by server version). Properties Name Type Description ok number Is 1 if the command executed correctly. n number The total count of documents inserted. parallelCollectionScanCallback(error, cursors) lib/collection.js, line 1990 The callback format for results Name Type Description error MongoError An error instance representing the error during the execution. cursors Array.<Cursor> A list of cursors returned allowing for parallel reading of collection. resultCallback(error, result) lib/collection.js, line 1039 The callback format for results Name Type Description error MongoError An error instance representing the error during the execution. result object The result object if the command was executed successfully. updateWriteOpCallback(error, result) lib/collection.js, line 723 The callback format for inserts Name Type Description error MongoError An error instance representing the error during the execution. result Collection~updateWriteOpResult The result object if the command was executed successfully. updateWriteOpResultObject Properties: Name Type Argument Description result Object The raw result returned from MongoDB. Will vary depending on server version. Properties Name Type Description ok Number Is 1 if the command executed correctly. n Number The total count of documents scanned. nModified Number The total count of documents modified. connection Object The connection object used for the operation. matchedCount Number The number of documents that matched the filter. modifiedCount Number The number of documents that were modified. upsertedCount Number The number of documents upserted. upsertedId Object The upserted id. Properties Name Type Description _id ObjectId The upserted _id returned from the server. message Object The raw msg response wrapped in an internal class ops Array. In a response to replaceOne, contains the new value of the document on the server. This is the same document that was originally passed in, and is only here for legacy purposes. writeOpCallback(error, result) lib/collection.js, line 632 The callback format for inserts Name Type Description error MongoError An error instance representing the error during the execution. result Collection~WriteOpResult The result object if the command was executed successfully. WriteOpResultObject Properties: Name Type Description ops Array. All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany connection object The connection object used for the operation. result object The command result object. | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |