Type aliases Abstract Abstract:  {  close:  any  } 
Accepted Accepted
Fields
< TSchema ,  FieldType ,  AssignableType > :  {  readonly  [  key  in  KeysOfAType < TSchema ,  FieldType > ] ?:  AssignableType  } Type parameters TSchema FieldType AssignableType Add Add
To
Set
Operators
< Type > :  {  $each
?:  Flatten < Type > []  } Type parameters Alternative Type parameters Any Type parameters Array Array< Type > :  Type  extends  ReadonlyArray < infer   Item>  ?  Item  :  never 
Type parameters Array Array
Operator
< Type > :  {  $each
?:  Flatten < Type > [] ;  $position
?:  number ;  $slice
?:  number ;  $sort
?:  Sort  } Type parameters Type declaration Optional  $each?:  Flatten < Type > [] Optional  $position?:  number Optional  $slice?:  number Optional  $sort?:  Sort Auto Bitwise Bitwise
Filter
:  number  |  Binary  |  ReadonlyArray < number > Callback Callback
< T > :  ( error
?:  AnyError , result
?:  T )  =>  void Type parameters Change Type parameters Change Change
Stream
Events
< TSchema ,  TChange > :  {  change
:  any ;  end
:  any ;  error
:  any ;  init
:  any ;  more
:  any ;  response
:  any ;  resumeTokenChanged
:  any  }  &  AbstractCursorEvents Type parameters Client Client:  {  ended:  any  } 
Common Common:  "newListener"  |  "removeListener" 
Connection Connection:  {  close:  any ;  clusterTimeReceived:  any ;  commandFailed:  any ;  commandStarted:  any ;  commandSucceeded:  any ;  message:  any ;  pinned:  any ;  unpinned:  any  } 
Type declaration close: function cluster: function cluster( clusterTime:  Document ) :  void  command: function command: function command: function message: function message( message:  any ) :  void  pinned: function pinned( pinType:  string ) :  void  unpinned: function unpinned( pinType:  string ) :  void  Connection Connection
Pool
Events
:  {  connectionCheckOutFailed
:  any ;  connectionCheckOutStarted
:  any ;  connectionCheckedIn
:  any ;  connectionCheckedOut
:  any ;  connectionClosed
:  any ;  connectionCreated
:  any ;  connectionPoolCleared
:  any ;  connectionPoolClosed
:  any ;  connectionPoolCreated
:  any ;  connectionPoolReady
:  any ;  connectionReady
:  any  }  &  Omit < ConnectionEvents ,  "close"  |  "message" > Enhanced Enhanced< TRecordOrUnion ,  KeyUnion > :  string  extends  keyof  TRecordOrUnion  ?  TRecordOrUnion  :  TRecordOrUnion  extends  any  ?  Pick < TRecordOrUnion ,  Exclude < keyof  TRecordOrUnion ,  KeyUnion > >  :  never 
Type parameters Event Event:  {   } 
Explain Explain:  string 
Filter Type parameters Flatten Flatten< Type > :  Type  extends  ReadonlyArray < infer   Item>  ?  Item  :  Type 
Type parameters GSSAPICanonicalization Generic Generic:  ( ... args:  any [] )  =>  void 
GridFSBucket GridFSBucket:  {  index:  any  } 
Index Index:  -1  |  1  |  "2d"  |  "2dsphere"  |  "text"  |  "geoHaystack"  |  "hashed"  |  number 
Infer Infer
Id
Type
< TSchema > :  TSchema  extends  {  _id
:  infer   IdType
 }  ?  Record < any ,  never >  extends  IdType  ?  never  :  IdType  :  TSchema  extends  {  _id
?:  infer   IdType
 }  ?  unknown  extends  IdType  ?  ObjectId  :  IdType  :  ObjectId Type parameters Is Is< Type ,  ResultIfAny ,  ResultIfNotAny > :  true  extends  false  &  Type  ?  ResultIfAny  :  ResultIfNotAny 
Type parameters Type ResultIfAny ResultIfNotAny Join Join
< T ,  D > :  T  extends  [ ]  ?  ""  :  T  extends  [ string  |  number ]  ?  ` ${ T [ 0 ] } `  :  T  extends  [ string  |  number ,  ... infer   R
]  ?  ` ${ T [ 0 ] } ${ D } ${ Join < R ,  D > } `  :  string Type parameters Keys Keys< TSchema ,  Type > :  {  [  key  in  keyof  TSchema ] :  NonNullable < TSchema [ key ] >  extends  Type  ?  key  :  never  } [ keyof  TSchema ] 
Type parameters Keys Keys< TSchema ,  Type > :  {  [  key  in  keyof  TSchema ] :  NonNullable < TSchema [ key ] >  extends  Type  ?  never  :  key  } [ keyof  TSchema ] 
Type parameters Match Match< TSchema > :  Readonly < Partial < TSchema > >  &  Record < string ,  any > 
Type parameters Monitor Monitor
Events
:  {  close
:  any ;  resetConnectionPool
:  any ;  resetServer
:  any ;  serverHeartbeatFailed
:  any ;  serverHeartbeatStarted
:  any ;  serverHeartbeatSucceeded
:  any  }  &  EventEmitterWithState Nested Nested
Paths
< Type ,  Depth > :  Depth [ "length" ]  extends  8  ?  [ ]  :  Type  extends  string  |  number  |  bigint  |  boolean  |  Date  |  RegExp  |  Buffer  |  Uint8Array  |  ( ( ... args
:  any [] )  =>  any )  |  {  _bsontype
:  string  }  ?  [ ]  :  Type  extends  ReadonlyArray < infer   ArrayType
>  ?  [ ]  |  [ number ,  ... NestedPaths < ArrayType ,  [ ... Depth ,  1 ] > ]  :  Type  extends  Map < string ,  any >  ?  [ string ]  :  Type  extends  object  ?  {  [  Key  in  Extract < keyof  Type ,  string > ] :  Type [ Key ]  extends  Type  ?  [ Key ]  :  Type  extends  Type [ Key ]  ?  [ Key ]  :  Type [ Key ]  extends  ReadonlyArray < infer   ArrayType
>  ?  Type  extends  ArrayType  ?  [ Key ]  :  ArrayType  extends  Type  ?  [ Key ]  :  [ Key ,  ... NestedPaths < Type [ Key ] ,  [ ... Depth ,  1 ] > ]  :  [ Key ,  ... NestedPaths < Type [ Key ] ,  [ ... Depth ,  1 ] > ]  |  [ Key ]  } [ Extract < keyof  Type ,  string > ]  :  [ ] Type parameters Nested Type parameters Not Not
Accepted
Fields
< TSchema ,  FieldType > :  {  readonly  [  key  in  KeysOfOtherType < TSchema ,  FieldType > ] ?:  never  } Type parameters One One< T > :  T  |  ReadonlyArray < T > 
Type parameters Only Only
Fields
Of
Type
< TSchema ,  FieldType ,  AssignableType > :  IsAny < TSchema [ keyof  TSchema ] ,  Record < string ,  FieldType > ,  AcceptedFields < TSchema ,  FieldType ,  AssignableType >  &  NotAcceptedFields < TSchema ,  FieldType >  &  Record < string ,  AssignableType > > Type parameters TSchema FieldType = any  AssignableType = FieldType  Optional Type parameters Optional Optional
Unless
Required
Id
< TSchema > :  TSchema  extends  {  _id
:  any  }  ?  TSchema  :  OptionalId < TSchema > Type parameters Property Property
Type
< Type ,  Property > :  string  extends  Property  ?  unknown  :  Property  extends  keyof  Type  ?  Type [ Property ]  :  Property  extends  ` ${ number } `  ?  Type  extends  ReadonlyArray < infer   ArrayType
>  ?  ArrayType  :  unknown  :  Property  extends  ` ${ infer   Key
} . ${ infer   Rest
} `  ?  Key  extends  ` ${ number } `  ?  Type  extends  ReadonlyArray < infer   ArrayType
>  ?  PropertyType < ArrayType ,  Rest >  :  unknown  :  Key  extends  keyof  Type  ?  Type [ Key ]  extends  Map < string ,  infer   MapType
>  ?  MapType  :  PropertyType < Type [ Key ] ,  Rest >  :  unknown  :  unknown Type parameters Pull Pull
All
Operator
< TSchema > :  ( {  readonly  [  key  in  KeysOfAType < TSchema ,  ReadonlyArray < any > > ] ?:  TSchema [ key ]  }  &  NotAcceptedFields < TSchema ,  ReadonlyArray < any > > )  &  {} Type parameters Pull Type parameters Push Type parameters Reg Reg
Exp
Or
String
< T > :  T  extends  string  ?  BSONRegExp  |  RegExp  |  T  :  T Type parameters Resume Resume:  unknown 
Run Run
Command
Options
:  {  authdb
?:  any ;  collation
?:  any ;  comment
?:  any ;  dbName
?:  any ;  explain
?:  any ;  maxTimeMS
?:  any ;  noResponse
?:  any ;  omitReadPreference
?:  any ;  readConcern
?:  any ;  readPreference
?:  ReadPreferenceLike ;  retryWrites
?:  any ;  session
?:  ClientSession ;  willRetryWrite
?:  any ;  writeConcern
?:  any  }  &  BSONSerializeOptions Schema Schema< T ,  V > :  {  [  P  in  keyof  T ] ?:  V  }  |  {} 
Type parameters Server Server
Events
:  {  closed
:  any ;  connect
:  any ;  descriptionReceived
:  any ;  ended
:  any ;  serverHeartbeatFailed
:  any ;  serverHeartbeatStarted
:  any ;  serverHeartbeatSucceeded
:  any  }  &  ConnectionPoolEvents  &  EventEmitterWithState Server Server
Session
Id
:  {  id
:  Binary  } Sort Sort:  1  |  -1  |  "asc"  |  "desc"  |  "ascending"  |  "descending"  |  {  $meta:  string  } 
Stream Stream:  Socket  |  TLSSocket 
Strict Type parameters Strict Type parameters Strict Strict
Update
Filter
< TSchema > :  {  $addToSet
?:  SetFields < TSchema > ;  $bit
?:  OnlyFieldsOfType < TSchema ,  NumericType  |  undefined ,  {  and
:  IntegerType  }  |  {  or
:  IntegerType  }  |  {  xor
:  IntegerType  } > ;  $currentDate
?:  OnlyFieldsOfType < TSchema ,  Date  |  Timestamp ,  true  |  {  $type
:  "date"  |  "timestamp"  } > ;  $inc
?:  OnlyFieldsOfType < TSchema ,  NumericType  |  undefined > ;  $max
?:  StrictMatchKeysAndValues < TSchema > ;  $min
?:  StrictMatchKeysAndValues < TSchema > ;  $mul
?:  OnlyFieldsOfType < TSchema ,  NumericType  |  undefined > ;  $pop
?:  OnlyFieldsOfType < TSchema ,  ReadonlyArray < any > ,  1  |  -1 > ;  $pull
?:  PullOperator < TSchema > ;  $pullAll
?:  PullAllOperator < TSchema > ;  $push
?:  PushOperator < TSchema > ;  $rename
?:  Record < string ,  string > ;  $set
?:  StrictMatchKeysAndValues < TSchema > ;  $setOnInsert
?:  StrictMatchKeysAndValues < TSchema > ;  $unset
?:  OnlyFieldsOfType < TSchema ,  any ,  ""  |  true  |  1 >  }  &  Document Type parameters Supported SupportedTLSConnection SupportedTLSConnection
Options
:  Pick < TLSConnectionOptions ,  Extract < keyof  TLSConnectionOptions ,  typeof  LEGAL_TLS_SOCKET_OPTIONS [ number ] > > SupportedTLSSocket SupportedTLSSocket
Options
:  Pick < TLSSocketOptions ,  Extract < keyof  TLSSocketOptions ,  typeof  LEGAL_TLS_SOCKET_OPTIONS [ number ] > > Update Update
Filter
< TSchema > :  {  $addToSet
?:  SetFields < TSchema > ;  $bit
?:  OnlyFieldsOfType < TSchema ,  NumericType  |  undefined ,  {  and
:  IntegerType  }  |  {  or
:  IntegerType  }  |  {  xor
:  IntegerType  } > ;  $currentDate
?:  OnlyFieldsOfType < TSchema ,  Date  |  Timestamp ,  true  |  {  $type
:  "date"  |  "timestamp"  } > ;  $inc
?:  OnlyFieldsOfType < TSchema ,  NumericType  |  undefined > ;  $max
?:  MatchKeysAndValues < TSchema > ;  $min
?:  MatchKeysAndValues < TSchema > ;  $mul
?:  OnlyFieldsOfType < TSchema ,  NumericType  |  undefined > ;  $pop
?:  OnlyFieldsOfType < TSchema ,  ReadonlyArray < any > ,  1  |  -1 > ;  $pull
?:  PullOperator < TSchema > ;  $pullAll
?:  PullAllOperator < TSchema > ;  $push
?:  PushOperator < TSchema > ;  $rename
?:  Record < string ,  string > ;  $set
?:  MatchKeysAndValues < TSchema > ;  $setOnInsert
?:  MatchKeysAndValues < TSchema > ;  $unset
?:  OnlyFieldsOfType < TSchema ,  any ,  ""  |  true  |  1 >  }  &  Document Type parameters With Type declaration Parameters Returns Promise < any >  With With
Transaction
Callback
< T > :  ( session
:  ClientSession )  =>  Promise < T > Type parameters Type declaration Parameters Returns Promise < T >  Without Without< TSchema > :  Omit < TSchema ,  "_id" > 
Type parameters Variables Const  AuthAuth:  Readonly < {  MONGODB_AWS:  "MONGODB-AWS" ;  MONGODB_CR:  "MONGODB-CR" ;  MONGODB_DEFAULT:  "DEFAULT" ;  MONGODB_GSSAPI:  "GSSAPI" ;  MONGODB_OIDC:  "MONGODB-OIDC" ;  MONGODB_PLAIN:  "PLAIN" ;  MONGODB_SCRAM_SHA1:  "SCRAM-SHA-1" ;  MONGODB_SCRAM_SHA256:  "SCRAM-SHA-256" ;  MONGODB_X509:  "MONGODB-X509"  } >  = ... 
Const  AutoAuto:  Readonly < {  Error:  1 ;  FatalError:  0 ;  Info:  3 ;  Trace:  4 ;  Warning:  2  } >  = ... 
Const  BatchBatch:  Readonly < {  DELETE:  3 ;  INSERT:  1 ;  UPDATE:  2  } >  = ... 
Const  CURSOR_CURSOR_:  readonly  [ "tailable" ,  "oplogReplay" ,  "noCursorTimeout" ,  "awaitData" ,  "exhaust" ,  "partial" ]  = ... 
Const  CompressorCompressor:  Readonly < {  none:  0 ;  snappy:  1 ;  zlib:  2 ;  zstd:  3  } >  = ... 
Const  ExplainExplain:  Readonly < {  allPlansExecution:  "allPlansExecution" ;  executionStats:  "executionStats" ;  queryPlanner:  "queryPlanner" ;  queryPlannerExtended:  "queryPlannerExtended"  } >  = ... 
Const  GSSAPICanonicalizationGSSAPICanonicalization:  Readonly < {  forward:  "forward" ;  forwardAndReverse:  "forwardAndReverse" ;  none:  "none" ;  off:  false ;  on:  true  } >  = ... 
Const  LEGAL_LEGAL_:  readonly  [ "family" ,  "hints" ,  "localAddress" ,  "localPort" ,  "lookup" ]  = ... 
Const  LEGAL_LEGAL_:  readonly  [ "ALPNProtocols" ,  "ca" ,  "cert" ,  "checkServerIdentity" ,  "ciphers" ,  "crl" ,  "ecdhCurve" ,  "key" ,  "minDHSize" ,  "passphrase" ,  "pfx" ,  "rejectUnauthorized" ,  "secureContext" ,  "secureProtocol" ,  "servername" ,  "session" ]  = ... 
Const  MONGO_MONGO_:  readonly  [ "connectionPoolCreated" ,  "connectionPoolReady" ,  "connectionPoolCleared" ,  "connectionPoolClosed" ,  "connectionCreated" ,  "connectionReady" ,  "connectionClosed" ,  "connectionCheckOutStarted" ,  "connectionCheckOutFailed" ,  "connectionCheckedOut" ,  "connectionCheckedIn" ,  "commandStarted" ,  "commandSucceeded" ,  "commandFailed" ,  "serverOpening" ,  "serverClosed" ,  "serverDescriptionChanged" ,  "topologyOpening" ,  "topologyClosed" ,  "topologyDescriptionChanged" ,  "error" ,  "timeout" ,  "close" ,  "serverHeartbeatStarted" ,  "serverHeartbeatSucceeded" ,  "serverHeartbeatFailed" ]  = ... 
Const  MongoMongo:  Readonly < {  HandshakeError:  "HandshakeError" ;  InterruptInUseConnections:  "InterruptInUseConnections" ;  NoWritesPerformed:  "NoWritesPerformed" ;  ResetPool:  "ResetPool" ;  ResumableChangeStreamError:  "ResumableChangeStreamError" ;  RetryableWriteError:  "RetryableWriteError" ;  TransientTransactionError:  "TransientTransactionError" ;  UnknownTransactionCommitResult:  "UnknownTransactionCommitResult"  } >  = ... 
Const  ProfilingProfiling:  Readonly < {  all:  "all" ;  off:  "off" ;  slowOnly:  "slow_only"  } >  = ... 
Const  ReadRead:  Readonly < {  available:  "available" ;  linearizable:  "linearizable" ;  local:  "local" ;  majority:  "majority" ;  snapshot:  "snapshot"  } >  = ... 
Const  ReadRead:  Readonly < {  nearest:  "nearest" ;  primary:  "primary" ;  primaryPreferred:  "primaryPreferred" ;  secondary:  "secondary" ;  secondaryPreferred:  "secondaryPreferred"  } >  = ... 
Const  ReturnReturn:  Readonly < {  AFTER:  "after" ;  BEFORE:  "before"  } >  = ... 
Const  ServerServer:  Readonly < {  v1:  "1"  } >  = ... 
Const  ServerServer:  Readonly < {  LoadBalancer:  "LoadBalancer" ;  Mongos:  "Mongos" ;  PossiblePrimary:  "PossiblePrimary" ;  RSArbiter:  "RSArbiter" ;  RSGhost:  "RSGhost" ;  RSOther:  "RSOther" ;  RSPrimary:  "RSPrimary" ;  RSSecondary:  "RSSecondary" ;  Standalone:  "Standalone" ;  Unknown:  "Unknown"  } >  = ... 
Const  TopologyTopology:  Readonly < {  LoadBalanced:  "LoadBalanced" ;  ReplicaSetNoPrimary:  "ReplicaSetNoPrimary" ;  ReplicaSetWithPrimary:  "ReplicaSetWithPrimary" ;  Sharded:  "Sharded" ;  Single:  "Single" ;  Unknown:  "Unknown"  } >  = ... 
It is possible to search using alternative types in mongodb e.g. string types can be searched using a regex in mongo array types can be searched using their element type