123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753 |
- import { Binary } from 'bson';
- import { BSON } from 'bson';
- import { BSONRegExp } from 'bson';
- import { BSONSymbol } from 'bson';
- import { BSONType } from 'bson';
- import { Code } from 'bson';
- import type { ConnectionOptions as ConnectionOptions_2 } from 'tls';
- import { DBRef } from 'bson';
- import { Decimal128 } from 'bson';
- import { deserialize } from 'bson';
- import type { DeserializeOptions } from 'bson';
- import * as dns from 'dns';
- import { Document } from 'bson';
- import { Double } from 'bson';
- import { Duplex } from 'stream';
- import { DuplexOptions } from 'stream';
- import { EventEmitter } from 'events';
- import { Int32 } from 'bson';
- import { Long } from 'bson';
- import { MaxKey } from 'bson';
- import { MinKey } from 'bson';
- import { ObjectId } from 'bson';
- import type { ObjectIdLike } from 'bson';
- import { Readable } from 'stream';
- import { serialize } from 'bson';
- import type { SerializeOptions } from 'bson';
- import type { Socket } from 'net';
- import type { SrvRecord } from 'dns';
- import type { TcpNetConnectOpts } from 'net';
- import { Timestamp } from 'bson';
- import type { TLSSocket } from 'tls';
- import type { TLSSocketOptions } from 'tls';
- import { Writable } from 'stream';
- export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> {
-
-
-
-
-
-
-
-
-
-
-
-
- static readonly CLOSE: "close";
-
- get id(): Long | undefined;
-
-
-
- get namespace(): MongoDBNamespace;
- get readPreference(): ReadPreference;
- get readConcern(): ReadConcern | undefined;
-
-
-
- get closed(): boolean;
- get killed(): boolean;
- get loadBalanced(): boolean;
-
- bufferedCount(): number;
-
- readBufferedDocuments(number?: number): TSchema[];
- [Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void>;
- stream(options?: CursorStreamOptions): Readable & AsyncIterable<TSchema>;
- hasNext(): Promise<boolean>;
-
- next(): Promise<TSchema | null>;
-
- tryNext(): Promise<TSchema | null>;
-
- forEach(iterator: (doc: TSchema) => boolean | void): Promise<void>;
- close(): Promise<void>;
-
- toArray(): Promise<TSchema[]>;
-
- addCursorFlag(flag: CursorFlag, value: boolean): this;
-
- map<T = any>(transform: (doc: TSchema) => T): AbstractCursor<T>;
- /**
- * Set the ReadPreference for the cursor.
- *
- * @param readPreference - The new read preference for the cursor.
- */
- withReadPreference(readPreference: ReadPreferenceLike): this;
- /**
- * Set the ReadPreference for the cursor.
- *
- * @param readPreference - The new read preference for the cursor.
- */
- withReadConcern(readConcern: ReadConcernLike): this;
- /**
- * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher)
- *
- * @param value - Number of milliseconds to wait before aborting the query.
- */
- maxTimeMS(value: number): this;
- /**
- * Set the batch size for the cursor.
- *
- * @param value - The number of documents to return per batch. See {@link https://www.mongodb.com/docs/manual/reference/command/find/|find command documentation}.
- */
- batchSize(value: number): this;
- /**
- * Rewind this cursor to its uninitialized state. Any options that are present on the cursor will
- * remain in effect. Iterating this cursor will cause new queries to be sent to the server, even
- * if the resultant data has already been retrieved by this cursor.
- */
- rewind(): void;
- /**
- * Returns a new uninitialized copy of this cursor, with options matching those that have been set on the current instance
- */
- abstract clone(): AbstractCursor<TSchema>;
- /* Excluded from this release type: _initialize */
- /* Excluded from this release type: _getMore */
- /* Excluded from this release type: [kInit] */
- }
- /** @public */
- export declare type AbstractCursorEvents = {
- [AbstractCursor.CLOSE](): void;
- };
- /** @public */
- export declare interface AbstractCursorOptions extends BSONSerializeOptions {
- session?: ClientSession;
- readPreference?: ReadPreferenceLike;
- readConcern?: ReadConcernLike;
- /**
- * Specifies the number of documents to return in each response from MongoDB
- */
- batchSize?: number;
- /**
- * When applicable `maxTimeMS` controls the amount of time the initial command
- * that constructs a cursor should take. (ex. find, aggregate, listCollections)
- */
- maxTimeMS?: number;
- /**
- * When applicable `maxAwaitTimeMS` controls the amount of time subsequent getMores
- * that a cursor uses to fetch more data should take. (ex. cursor.next())
- */
- maxAwaitTimeMS?: number;
- /**
- * Comment to apply to the operation.
- *
- * In server versions pre-4.4, 'comment' must be string. A server
- * error will be thrown if any other type is provided.
- *
- * In server versions 4.4 and above, 'comment' can be any valid BSON type.
- */
- comment?: unknown;
- /**
- * By default, MongoDB will automatically close a cursor when the
- * client has exhausted all results in the cursor. However, for [capped collections](https:
- * you may use a Tailable Cursor that remains open after the client exhausts
- * the results in the initial cursor.
- */
- tailable?: boolean;
-
- awaitData?: boolean;
- noCursorTimeout?: boolean;
- }
- export declare type AcceptedFields<TSchema, FieldType, AssignableType> = {
- readonly [key in KeysOfAType<TSchema, FieldType>]?: AssignableType;
- };
- export declare type AddToSetOperators<Type> = {
- $each?: Array<Flatten<Type>>;
- };
- export declare interface AddUserOptions extends CommandOperationOptions {
-
- roles?: string | string[] | RoleSpecification | RoleSpecification[];
-
- customData?: Document;
- }
- export declare class Admin {
-
-
-
- command(command: Document, options?: RunCommandOptions): Promise<Document>;
-
- buildInfo(options?: CommandOperationOptions): Promise<Document>;
-
- serverInfo(options?: CommandOperationOptions): Promise<Document>;
-
- serverStatus(options?: CommandOperationOptions): Promise<Document>;
-
- ping(options?: CommandOperationOptions): Promise<Document>;
-
- addUser(username: string, passwordOrOptions?: string | AddUserOptions, options?: AddUserOptions): Promise<Document>;
-
- removeUser(username: string, options?: RemoveUserOptions): Promise<boolean>;
-
- validateCollection(collectionName: string, options?: ValidateCollectionOptions): Promise<Document>;
-
- listDatabases(options?: ListDatabasesOptions): Promise<ListDatabasesResult>;
-
- replSetGetStatus(options?: CommandOperationOptions): Promise<Document>;
- }
- export declare interface AggregateOptions extends CommandOperationOptions {
-
- allowDiskUse?: boolean;
-
- batchSize?: number;
-
- bypassDocumentValidation?: boolean;
-
- cursor?: Document;
-
- maxTimeMS?: number;
-
- maxAwaitTimeMS?: number;
-
- collation?: CollationOptions;
-
- hint?: Hint;
-
- let?: Document;
- out?: string;
- }
- export declare class AggregationCursor<TSchema = any> extends AbstractCursor<TSchema> {
-
-
-
- get pipeline(): Document[];
- clone(): AggregationCursor<TSchema>;
- map<T>(transform: (doc: TSchema) => T): AggregationCursor<T>;
-
-
- explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
-
- group<T = TSchema>($group: Document): AggregationCursor<T>;
-
- limit($limit: number): this;
-
- match($match: Document): this;
-
- out($out: {
- db: string;
- coll: string;
- } | string): this;
-
- project<T extends Document = Document>($project: Document): AggregationCursor<T>;
-
- lookup($lookup: Document): this;
-
- redact($redact: Document): this;
-
- skip($skip: number): this;
-
- sort($sort: Sort): this;
-
- unwind($unwind: Document | string): this;
-
- geoNear($geoNear: Document): this;
- }
- export declare interface AggregationCursorOptions extends AbstractCursorOptions, AggregateOptions {
- }
- export declare type AlternativeType<T> = T extends ReadonlyArray<infer U> ? T | RegExpOrString<U> : RegExpOrString<T>;
- export declare type AnyBulkWriteOperation<TSchema extends Document = Document> = {
- insertOne: InsertOneModel<TSchema>;
- } | {
- replaceOne: ReplaceOneModel<TSchema>;
- } | {
- updateOne: UpdateOneModel<TSchema>;
- } | {
- updateMany: UpdateManyModel<TSchema>;
- } | {
- deleteOne: DeleteOneModel<TSchema>;
- } | {
- deleteMany: DeleteManyModel<TSchema>;
- };
- export declare type AnyError = MongoError | Error;
- export declare type ArrayElement<Type> = Type extends ReadonlyArray<infer Item> ? Item : never;
- export declare type ArrayOperator<Type> = {
- $each?: Array<Flatten<Type>>;
- $slice?: number;
- $position?: number;
- $sort?: Sort;
- };
- export declare interface Auth {
-
- username?: string;
-
- password?: string;
- }
- export declare const AuthMechanism: Readonly<{
- readonly MONGODB_AWS: "MONGODB-AWS";
- readonly MONGODB_CR: "MONGODB-CR";
- readonly MONGODB_DEFAULT: "DEFAULT";
- readonly MONGODB_GSSAPI: "GSSAPI";
- readonly MONGODB_PLAIN: "PLAIN";
- readonly MONGODB_SCRAM_SHA1: "SCRAM-SHA-1";
- readonly MONGODB_SCRAM_SHA256: "SCRAM-SHA-256";
- readonly MONGODB_X509: "MONGODB-X509";
-
- readonly MONGODB_OIDC: "MONGODB-OIDC";
- }>;
- export declare type AuthMechanism = (typeof AuthMechanism)[keyof typeof AuthMechanism];
- export declare interface AuthMechanismProperties extends Document {
- SERVICE_HOST?: string;
- SERVICE_NAME?: string;
- SERVICE_REALM?: string;
- CANONICALIZE_HOST_NAME?: GSSAPICanonicalizationValue;
- AWS_SESSION_TOKEN?: string;
-
- REQUEST_TOKEN_CALLBACK?: OIDCRequestFunction;
-
- REFRESH_TOKEN_CALLBACK?: OIDCRefreshFunction;
-
- PROVIDER_NAME?: 'aws' | 'azure';
-
- ALLOWED_HOSTS?: string[];
-
- TOKEN_AUDIENCE?: string;
- }
- export declare interface AutoEncrypter {
- new (client: MongoClient, options: AutoEncryptionOptions): AutoEncrypter;
- init(cb: Callback): void;
- teardown(force: boolean, callback: Callback): void;
- encrypt(ns: string, cmd: Document, options: any, callback: Callback<Document>): void;
- decrypt(cmd: Document, options: any, callback: Callback<Document>): void;
-
- readonly cryptSharedLibVersionInfo: {
- version: bigint;
- versionStr: string;
- } | null;
- }
- export declare const AutoEncryptionLoggerLevel: Readonly<{
- readonly FatalError: 0;
- readonly Error: 1;
- readonly Warning: 2;
- readonly Info: 3;
- readonly Trace: 4;
- }>;
- export declare type AutoEncryptionLoggerLevel = (typeof AutoEncryptionLoggerLevel)[keyof typeof AutoEncryptionLoggerLevel];
- export declare interface AutoEncryptionOptions {
-
-
- keyVaultClient?: MongoClient;
-
- keyVaultNamespace?: string;
-
- kmsProviders?: {
-
- aws?: {
-
- accessKeyId: string;
-
- secretAccessKey: string;
-
- sessionToken?: string;
- } | Record<string, never>;
-
- local?: {
-
- key: Buffer | string;
- };
-
- azure?: {
-
- tenantId: string;
-
- clientId: string;
-
- clientSecret: string;
-
- identityPlatformEndpoint?: string | undefined;
- } | {
-
- accessToken: string;
- } | Record<string, never>;
-
- gcp?: {
-
- email: string;
-
- privateKey: string | Buffer;
-
- endpoint?: string | undefined;
- } | {
-
- accessToken: string;
- } | Record<string, never>;
-
- kmip?: {
-
- endpoint?: string;
- };
- };
-
- schemaMap?: Document;
-
- encryptedFieldsMap?: Document;
-
- bypassAutoEncryption?: boolean;
-
- bypassQueryAnalysis?: boolean;
- options?: {
-
- logger?: (level: AutoEncryptionLoggerLevel, message: string) => void;
- };
- extraOptions?: {
-
- mongocryptdURI?: string;
-
- mongocryptdBypassSpawn?: boolean;
-
- mongocryptdSpawnPath?: string;
-
- mongocryptdSpawnArgs?: string[];
-
- cryptSharedLibPath?: string;
-
- cryptSharedLibRequired?: boolean;
-
- };
- proxyOptions?: ProxyOptions;
-
- tlsOptions?: {
- aws?: AutoEncryptionTlsOptions;
- local?: AutoEncryptionTlsOptions;
- azure?: AutoEncryptionTlsOptions;
- gcp?: AutoEncryptionTlsOptions;
- kmip?: AutoEncryptionTlsOptions;
- };
- }
- export declare interface AutoEncryptionTlsOptions {
-
- tlsCertificateKeyFile?: string;
-
- tlsCertificateKeyFilePassword?: string;
-
- tlsCAFile?: string;
- }
- export declare class Batch<T = Document> {
- originalZeroIndex: number;
- currentIndex: number;
- originalIndexes: number[];
- batchType: BatchType;
- operations: T[];
- size: number;
- sizeBytes: number;
- constructor(batchType: BatchType, originalZeroIndex: number);
- }
- export declare const BatchType: Readonly<{
- readonly INSERT: 1;
- readonly UPDATE: 2;
- readonly DELETE: 3;
- }>;
- export declare type BatchType = (typeof BatchType)[keyof typeof BatchType];
- export { Binary }
- export declare type BitwiseFilter = number | Binary | ReadonlyArray<number>;
- export { BSON }
- export { BSONRegExp }
- export declare interface BSONSerializeOptions extends Omit<SerializeOptions, 'index'>, Omit<DeserializeOptions, 'evalFunctions' | 'cacheFunctions' | 'cacheFunctionsCrc32' | 'allowObjectSmallerThanBufferSize' | 'index' | 'validation'> {
-
- raw?: boolean;
-
- enableUtf8Validation?: boolean;
- }
- export { BSONSymbol }
- export { BSONType }
- export declare type BSONTypeAlias = keyof typeof BSONType;
- export declare abstract class BulkOperationBase {
- isOrdered: boolean;
-
- operationId?: number;
-
-
- insert(document: Document): BulkOperationBase;
-
- find(selector: Document): FindOperators;
-
- raw(op: AnyBulkWriteOperation): this;
- get bsonOptions(): BSONSerializeOptions;
- get writeConcern(): WriteConcern | undefined;
- get batches(): Batch[];
- execute(options?: BulkWriteOptions): Promise<BulkWriteResult>;
-
- abstract addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
- }
- export declare interface BulkWriteOperationError {
- index: number;
- code: number;
- errmsg: string;
- errInfo: Document;
- op: Document | UpdateStatement | DeleteStatement;
- }
- export declare interface BulkWriteOptions extends CommandOperationOptions {
-
- bypassDocumentValidation?: boolean;
-
- ordered?: boolean;
-
- forceServerObjectId?: boolean;
-
- let?: Document;
- }
- export declare class BulkWriteResult {
- private readonly result;
-
- readonly insertedCount: number;
-
- readonly matchedCount: number;
-
- readonly modifiedCount: number;
-
- readonly deletedCount: number;
-
- readonly upsertedCount: number;
-
- readonly upsertedIds: {
- [key: number]: any;
- };
-
- readonly insertedIds: {
- [key: number]: any;
- };
- private static generateIdMap;
-
-
- get ok(): number;
-
- get nInserted(): number;
-
- get nUpserted(): number;
-
- get nMatched(): number;
-
- get nModified(): number;
-
- get nRemoved(): number;
-
- getInsertedIds(): Document[];
-
- getUpsertedIds(): Document[];
-
- getUpsertedIdAt(index: number): Document | undefined;
-
- getRawResponse(): Document;
-
- hasWriteErrors(): boolean;
-
- getWriteErrorCount(): number;
-
- getWriteErrorAt(index: number): WriteError | undefined;
-
- getWriteErrors(): WriteError[];
-
- getWriteConcernError(): WriteConcernError | undefined;
- toString(): string;
- isOk(): boolean;
- }
- export declare type Callback<T = any> = (error?: AnyError, result?: T) => void;
- export declare class CancellationToken extends TypedEventEmitter<{
- cancel(): void;
- }> {
- }
- export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> {
- pipeline: Document[];
-
- options: ChangeStreamOptions & {
- writeConcern?: never;
- };
- parent: MongoClient | Db | Collection;
- namespace: MongoDBNamespace;
- type: symbol;
-
- streamOptions?: CursorStreamOptions;
-
-
-
-
- static readonly RESPONSE: "response";
-
- static readonly MORE: "more";
-
- static readonly INIT: "init";
-
- static readonly CLOSE: "close";
-
- static readonly CHANGE: "change";
-
- static readonly END: "end";
-
- static readonly ERROR: "error";
-
- static readonly RESUME_TOKEN_CHANGED: "resumeTokenChanged";
-
-
-
- get resumeToken(): ResumeToken;
-
- hasNext(): Promise<boolean>;
-
- next(): Promise<TChange>;
-
- tryNext(): Promise<TChange | null>;
- [Symbol.asyncIterator](): AsyncGenerator<TChange, void, void>;
-
- get closed(): boolean;
-
- close(): Promise<void>;
-
- stream(options?: CursorStreamOptions): Readable & AsyncIterable<TChange>;
-
-
-
-
-
-
-
-
-
- }
- export declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'modify';
- }
- export declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'create';
- }
- export declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
-
- operationType: 'createIndexes';
- }
- export declare interface ChangeStreamDeleteDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'delete';
-
- ns: ChangeStreamNameSpace;
-
- fullDocumentBeforeChange?: TSchema;
- }
- export declare type ChangeStreamDocument<TSchema extends Document = Document> = ChangeStreamInsertDocument<TSchema> | ChangeStreamUpdateDocument<TSchema> | ChangeStreamReplaceDocument<TSchema> | ChangeStreamDeleteDocument<TSchema> | ChangeStreamDropDocument | ChangeStreamRenameDocument | ChangeStreamDropDatabaseDocument | ChangeStreamInvalidateDocument | ChangeStreamCreateIndexDocument | ChangeStreamCreateDocument | ChangeStreamCollModDocument | ChangeStreamDropIndexDocument | ChangeStreamShardCollectionDocument | ChangeStreamReshardCollectionDocument | ChangeStreamRefineCollectionShardKeyDocument;
- export declare interface ChangeStreamDocumentCollectionUUID {
-
- collectionUUID: Binary;
- }
- export declare interface ChangeStreamDocumentCommon {
-
- _id: ResumeToken;
-
- clusterTime?: Timestamp;
-
- txnNumber?: number;
-
- lsid?: ServerSessionId;
-
- splitEvent?: ChangeStreamSplitEvent;
- }
- export declare interface ChangeStreamDocumentKey<TSchema extends Document = Document> {
-
- documentKey: {
- _id: InferIdType<TSchema>;
- [shardKey: string]: any;
- };
- }
- export declare interface ChangeStreamDocumentOperationDescription {
-
- operationDescription?: Document;
- }
- export declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon {
-
- operationType: 'dropDatabase';
-
- ns: {
- db: string;
- };
- }
- export declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'drop';
-
- ns: ChangeStreamNameSpace;
- }
- export declare interface ChangeStreamDropIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
-
- operationType: 'dropIndexes';
- }
- export declare type ChangeStreamEvents<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> = {
- resumeTokenChanged(token: ResumeToken): void;
- init(response: any): void;
- more(response?: any): void;
- response(): void;
- end(): void;
- error(error: Error): void;
- change(change: TChange): void;
- } & AbstractCursorEvents;
- export declare interface ChangeStreamInsertDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'insert';
-
- fullDocument: TSchema;
-
- ns: ChangeStreamNameSpace;
- }
- export declare interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon {
-
- operationType: 'invalidate';
- }
- export declare interface ChangeStreamNameSpace {
- db: string;
- coll: string;
- }
- export declare interface ChangeStreamOptions extends Omit<AggregateOptions, 'writeConcern'> {
-
- fullDocument?: string;
-
- fullDocumentBeforeChange?: string;
-
- maxAwaitTimeMS?: number;
-
- resumeAfter?: ResumeToken;
-
- startAfter?: ResumeToken;
-
- startAtOperationTime?: OperationTime;
-
- batchSize?: number;
-
- showExpandedEvents?: boolean;
- }
- export declare interface ChangeStreamRefineCollectionShardKeyDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
-
- operationType: 'refineCollectionShardKey';
- }
- export declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'rename';
-
- to: {
- db: string;
- coll: string;
- };
-
- ns: ChangeStreamNameSpace;
- }
- export declare interface ChangeStreamReplaceDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema> {
-
- operationType: 'replace';
-
- fullDocument: TSchema;
-
- ns: ChangeStreamNameSpace;
-
- fullDocumentBeforeChange?: TSchema;
- }
- export declare interface ChangeStreamReshardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
-
- operationType: 'reshardCollection';
- }
- export declare interface ChangeStreamShardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
-
- operationType: 'shardCollection';
- }
- export declare interface ChangeStreamSplitEvent {
-
- fragment: number;
-
- of: number;
- }
- export declare interface ChangeStreamUpdateDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
-
- operationType: 'update';
-
- fullDocument?: TSchema;
-
- updateDescription: UpdateDescription<TSchema>;
-
- ns: ChangeStreamNameSpace;
-
- fullDocumentBeforeChange?: TSchema;
- }
- export declare interface ClientMetadata {
- driver: {
- name: string;
- version: string;
- };
- os: {
- type: string;
- name?: NodeJS.Platform;
- architecture?: string;
- version?: string;
- };
- platform: string;
- application?: {
- name: string;
- };
-
- env?: {
- name: 'aws.lambda' | 'gcp.func' | 'azure.func' | 'vercel';
- timeout_sec?: Int32;
- memory_mb?: Int32;
- region?: string;
- url?: string;
- };
- }
- export declare interface ClientMetadataOptions {
- driverInfo?: {
- name?: string;
- version?: string;
- platform?: string;
- };
- appName?: string;
- }
- export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
-
-
- hasEnded: boolean;
- clientOptions?: MongoOptions;
- supports: {
- causalConsistency: boolean;
- };
- clusterTime?: ClusterTime;
- operationTime?: Timestamp;
- explicit: boolean;
-
- defaultTransactionOptions: TransactionOptions;
- transaction: Transaction;
-
-
-
-
-
-
-
- get id(): ServerSessionId | undefined;
- get serverSession(): ServerSession;
-
- get snapshotEnabled(): boolean;
- get loadBalanced(): boolean;
-
-
-
- get isPinned(): boolean;
-
- endSession(options?: EndSessionOptions): Promise<void>;
-
- advanceOperationTime(operationTime: Timestamp): void;
-
- advanceClusterTime(clusterTime: ClusterTime): void;
-
- equals(session: ClientSession): boolean;
-
- incrementTransactionNumber(): void;
-
- inTransaction(): boolean;
-
- startTransaction(options?: TransactionOptions): void;
-
- commitTransaction(): Promise<Document>;
-
- abortTransaction(): Promise<Document>;
-
- toBSON(): never;
-
- withTransaction<T = void>(fn: WithTransactionCallback<T>, options?: TransactionOptions): Promise<Document | undefined>;
- }
- export declare type ClientSessionEvents = {
- ended(session: ClientSession): void;
- };
- export declare interface ClientSessionOptions {
-
- causalConsistency?: boolean;
-
- snapshot?: boolean;
-
- defaultTransactionOptions?: TransactionOptions;
-
-
-
- }
- export declare interface CloseOptions {
- force?: boolean;
- }
- export declare interface ClusteredCollectionOptions extends Document {
- name?: string;
- key: Document;
- unique: boolean;
- }
- export declare interface ClusterTime {
- clusterTime: Timestamp;
- signature: {
- hash: Binary;
- keyId: Long;
- };
- }
- export { Code }
- export declare interface CollationOptions {
- locale: string;
- caseLevel?: boolean;
- caseFirst?: string;
- strength?: number;
- numericOrdering?: boolean;
- alternate?: string;
- maxVariable?: string;
- backwards?: boolean;
- normalization?: boolean;
- }
- export declare class Collection<TSchema extends Document = Document> {
-
-
-
-
- get dbName(): string;
-
- get collectionName(): string;
-
- get namespace(): string;
-
-
- get readConcern(): ReadConcern | undefined;
-
- get readPreference(): ReadPreference | undefined;
- get bsonOptions(): BSONSerializeOptions;
-
- get writeConcern(): WriteConcern | undefined;
-
- get hint(): Hint | undefined;
- set hint(v: Hint | undefined);
-
- insertOne(doc: OptionalUnlessRequiredId<TSchema>, options?: InsertOneOptions): Promise<InsertOneResult<TSchema>>;
-
- insertMany(docs: OptionalUnlessRequiredId<TSchema>[], options?: BulkWriteOptions): Promise<InsertManyResult<TSchema>>;
-
- bulkWrite(operations: AnyBulkWriteOperation<TSchema>[], options?: BulkWriteOptions): Promise<BulkWriteResult>;
-
- updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, options?: UpdateOptions): Promise<UpdateResult<TSchema>>;
-
- replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options?: ReplaceOptions): Promise<UpdateResult<TSchema> | Document>;
-
- updateMany(filter: Filter<TSchema>, update: UpdateFilter<TSchema>, options?: UpdateOptions): Promise<UpdateResult<TSchema>>;
-
- deleteOne(filter?: Filter<TSchema>, options?: DeleteOptions): Promise<DeleteResult>;
-
- deleteMany(filter?: Filter<TSchema>, options?: DeleteOptions): Promise<DeleteResult>;
-
- rename(newName: string, options?: RenameOptions): Promise<Collection>;
-
- drop(options?: DropCollectionOptions): Promise<boolean>;
-
- findOne(): Promise<WithId<TSchema> | null>;
- findOne(filter: Filter<TSchema>): Promise<WithId<TSchema> | null>;
- findOne(filter: Filter<TSchema>, options: FindOptions): Promise<WithId<TSchema> | null>;
- findOne<T = TSchema>(): Promise<T | null>;
- findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
- findOne<T = TSchema>(filter: Filter<TSchema>, options?: FindOptions): Promise<T | null>;
-
- find(): FindCursor<WithId<TSchema>>;
- find(filter: Filter<TSchema>, options?: FindOptions): FindCursor<WithId<TSchema>>;
- find<T extends Document>(filter: Filter<TSchema>, options?: FindOptions): FindCursor<T>;
-
- options(options?: OperationOptions): Promise<Document>;
-
- isCapped(options?: OperationOptions): Promise<boolean>;
-
- createIndex(indexSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
-
- createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]>;
-
- dropIndex(indexName: string, options?: DropIndexesOptions): Promise<Document>;
-
- dropIndexes(options?: DropIndexesOptions): Promise<Document>;
-
- listIndexes(options?: ListIndexesOptions): ListIndexesCursor;
-
- indexExists(indexes: string | string[], options?: IndexInformationOptions): Promise<boolean>;
-
- indexInformation(options?: IndexInformationOptions): Promise<Document>;
-
- estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
-
- countDocuments(filter?: Document, options?: CountDocumentsOptions): Promise<number>;
-
- distinct<Key extends keyof WithId<TSchema>>(key: Key): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
- distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
- distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>, options: DistinctOptions): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
- distinct(key: string): Promise<any[]>;
- distinct(key: string, filter: Filter<TSchema>): Promise<any[]>;
- distinct(key: string, filter: Filter<TSchema>, options: DistinctOptions): Promise<any[]>;
-
- indexes(options?: IndexInformationOptions): Promise<Document[]>;
-
- stats(options?: CollStatsOptions): Promise<CollStats>;
-
- findOneAndDelete(filter: Filter<TSchema>, options: FindOneAndDeleteOptions & {
- includeResultMetadata: true;
- }): Promise<ModifyResult<TSchema>>;
- findOneAndDelete(filter: Filter<TSchema>, options: FindOneAndDeleteOptions & {
- includeResultMetadata: false;
- }): Promise<WithId<TSchema> | null>;
- findOneAndDelete(filter: Filter<TSchema>, options: FindOneAndDeleteOptions): Promise<ModifyResult<TSchema>>;
- findOneAndDelete(filter: Filter<TSchema>): Promise<ModifyResult<TSchema>>;
-
- findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions & {
- includeResultMetadata: true;
- }): Promise<ModifyResult<TSchema>>;
- findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions & {
- includeResultMetadata: false;
- }): Promise<WithId<TSchema> | null>;
- findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions): Promise<ModifyResult<TSchema>>;
- findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>): Promise<ModifyResult<TSchema>>;
-
- findOneAndUpdate(filter: Filter<TSchema>, update: UpdateFilter<TSchema>, options: FindOneAndUpdateOptions & {
- includeResultMetadata: true;
- }): Promise<ModifyResult<TSchema>>;
- findOneAndUpdate(filter: Filter<TSchema>, update: UpdateFilter<TSchema>, options: FindOneAndUpdateOptions & {
- includeResultMetadata: false;
- }): Promise<WithId<TSchema> | null>;
- findOneAndUpdate(filter: Filter<TSchema>, update: UpdateFilter<TSchema>, options: FindOneAndUpdateOptions): Promise<ModifyResult<TSchema>>;
- findOneAndUpdate(filter: Filter<TSchema>, update: UpdateFilter<TSchema>): Promise<ModifyResult<TSchema>>;
-
- aggregate<T extends Document = Document>(pipeline?: Document[], options?: AggregateOptions): AggregationCursor<T>;
-
- watch<TLocal extends Document = TSchema, TChange extends Document = ChangeStreamDocument<TLocal>>(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream<TLocal, TChange>;
-
- initializeUnorderedBulkOp(options?: BulkWriteOptions): UnorderedBulkOperation;
-
- initializeOrderedBulkOp(options?: BulkWriteOptions): OrderedBulkOperation;
-
- count(filter?: Filter<TSchema>, options?: CountOptions): Promise<number>;
-
- listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
-
- listSearchIndexes(name: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
-
- createSearchIndex(description: SearchIndexDescription): Promise<string>;
-
- createSearchIndexes(descriptions: SearchIndexDescription[]): Promise<string[]>;
-
- dropSearchIndex(name: string): Promise<void>;
-
- updateSearchIndex(name: string, definition: Document): Promise<void>;
- }
- export declare interface CollectionInfo extends Document {
- name: string;
- type?: string;
- options?: Document;
- info?: {
- readOnly?: false;
- uuid?: Binary;
- };
- idIndex?: Document;
- }
- export declare interface CollectionOptions extends BSONSerializeOptions, WriteConcernOptions {
-
- readConcern?: ReadConcernLike;
-
- readPreference?: ReadPreferenceLike;
- }
- export declare interface CollStats extends Document {
-
- ns: string;
-
- count: number;
-
- size: number;
-
- avgObjSize: number;
-
- storageSize: number;
-
- numExtents: number;
-
- nindexes: number;
-
- lastExtentSize: number;
-
- paddingFactor: number;
-
- userFlags?: number;
-
- totalIndexSize: number;
-
- indexSizes: {
- _id_: number;
- [index: string]: number;
- };
-
- capped: boolean;
-
- max: number;
-
- maxSize: number;
-
- wiredTiger?: WiredTigerData;
-
- indexDetails?: any;
- ok: number;
-
- freeStorageSize?: number;
-
- indexBuilds?: number;
-
- totalSize: number;
-
- scaleFactor: number;
- }
- export declare interface CollStatsOptions extends CommandOperationOptions {
-
- scale?: number;
- }
- export declare class CommandFailedEvent {
- address: string;
- connectionId?: string | number;
- requestId: number;
- duration: number;
- commandName: string;
- failure: Error;
- serviceId?: ObjectId;
-
-
- get hasServiceId(): boolean;
- }
- export declare interface CommandOperationOptions extends OperationOptions, WriteConcernOptions, ExplainOptions {
-
- readConcern?: ReadConcernLike;
-
- collation?: CollationOptions;
- maxTimeMS?: number;
-
- comment?: unknown;
-
- retryWrites?: boolean;
- dbName?: string;
- authdb?: string;
- noResponse?: boolean;
- }
- export declare class CommandStartedEvent {
- commandObj?: Document;
- requestId: number;
- databaseName: string;
- commandName: string;
- command: Document;
- address: string;
- connectionId?: string | number;
- serviceId?: ObjectId;
-
-
- get hasServiceId(): boolean;
- }
- export declare class CommandSucceededEvent {
- address: string;
- connectionId?: string | number;
- requestId: number;
- duration: number;
- commandName: string;
- reply: unknown;
- serviceId?: ObjectId;
-
-
- get hasServiceId(): boolean;
- }
- export declare type CommonEvents = 'newListener' | 'removeListener';
- export declare const Compressor: Readonly<{
- readonly none: 0;
- readonly snappy: 1;
- readonly zlib: 2;
- readonly zstd: 3;
- }>;
- export declare type Compressor = (typeof Compressor)[CompressorName];
- export declare type CompressorName = keyof typeof Compressor;
- export declare type Condition<T> = AlternativeType<T> | FilterOperators<AlternativeType<T>>;
- export declare class ConnectionCheckedInEvent extends ConnectionPoolMonitoringEvent {
-
- connectionId: number | '<monitor>';
-
-
- }
- export declare class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringEvent {
-
- connectionId: number | '<monitor>';
-
-
- }
- export declare class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitoringEvent {
-
- reason: string;
-
-
-
- }
- export declare class ConnectionCheckOutStartedEvent extends ConnectionPoolMonitoringEvent {
-
-
- }
- export declare class ConnectionClosedEvent extends ConnectionPoolMonitoringEvent {
-
- connectionId: number | '<monitor>';
-
- reason: string;
- serviceId?: ObjectId;
-
-
-
- }
- export declare class ConnectionCreatedEvent extends ConnectionPoolMonitoringEvent {
-
- connectionId: number | '<monitor>';
-
-
- }
- export declare type ConnectionEvents = {
- commandStarted(event: CommandStartedEvent): void;
- commandSucceeded(event: CommandSucceededEvent): void;
- commandFailed(event: CommandFailedEvent): void;
- clusterTimeReceived(clusterTime: Document): void;
- close(): void;
- message(message: any): void;
- pinned(pinType: string): void;
- unpinned(pinType: string): void;
- };
- export declare interface ConnectionOptions extends SupportedNodeConnectionOptions, StreamDescriptionOptions, ProxyOptions {
- id: number | '<monitor>';
- generation: number;
- hostAddress: HostAddress;
- autoEncrypter?: AutoEncrypter;
- serverApi?: ServerApi;
- monitorCommands: boolean;
-
- credentials?: MongoCredentials;
- connectTimeoutMS?: number;
- tls: boolean;
-
- keepAlive?: boolean;
-
- keepAliveInitialDelay?: number;
- noDelay?: boolean;
- socketTimeoutMS?: number;
- cancellationToken?: CancellationToken;
- metadata: ClientMetadata;
- }
- export declare class ConnectionPoolClearedEvent extends ConnectionPoolMonitoringEvent {
-
- interruptInUseConnections?: boolean;
-
-
- }
- export declare class ConnectionPoolClosedEvent extends ConnectionPoolMonitoringEvent {
-
-
- }
- export declare class ConnectionPoolCreatedEvent extends ConnectionPoolMonitoringEvent {
-
- options: Omit<ConnectionPoolOptions, 'credentials'> & {
- credentials?: Record<never, never>;
- };
-
-
- }
- export declare type ConnectionPoolEvents = {
- connectionPoolCreated(event: ConnectionPoolCreatedEvent): void;
- connectionPoolReady(event: ConnectionPoolReadyEvent): void;
- connectionPoolClosed(event: ConnectionPoolClosedEvent): void;
- connectionPoolCleared(event: ConnectionPoolClearedEvent): void;
- connectionCreated(event: ConnectionCreatedEvent): void;
- connectionReady(event: ConnectionReadyEvent): void;
- connectionClosed(event: ConnectionClosedEvent): void;
- connectionCheckOutStarted(event: ConnectionCheckOutStartedEvent): void;
- connectionCheckOutFailed(event: ConnectionCheckOutFailedEvent): void;
- connectionCheckedOut(event: ConnectionCheckedOutEvent): void;
- connectionCheckedIn(event: ConnectionCheckedInEvent): void;
- } & Omit<ConnectionEvents, 'close' | 'message'>;
- export declare abstract class ConnectionPoolMonitoringEvent {
-
- time: Date;
-
- address: string;
-
-
- }
- export declare interface ConnectionPoolOptions extends Omit<ConnectionOptions, 'id' | 'generation'> {
-
- maxPoolSize: number;
-
- minPoolSize: number;
-
- maxConnecting: number;
-
- maxIdleTimeMS: number;
-
- waitQueueTimeoutMS: number;
-
- loadBalanced: boolean;
-
- }
- export declare class ConnectionPoolReadyEvent extends ConnectionPoolMonitoringEvent {
-
-
- }
- export declare class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent {
-
- connectionId: number | '<monitor>';
-
-
- }
- export declare interface ConnectOptions {
- readPreference?: ReadPreference;
- }
- export declare interface CountDocumentsOptions extends AggregateOptions {
-
- skip?: number;
-
- limit?: number;
- }
- export declare interface CountOptions extends CommandOperationOptions {
-
- skip?: number;
-
- limit?: number;
-
- maxTimeMS?: number;
-
- hint?: string | Document;
- }
- export declare interface CreateCollectionOptions extends CommandOperationOptions {
-
- capped?: boolean;
-
- autoIndexId?: boolean;
-
- size?: number;
-
- max?: number;
-
- flags?: number;
-
- storageEngine?: Document;
-
- validator?: Document;
-
- validationLevel?: string;
-
- validationAction?: string;
-
- indexOptionDefaults?: Document;
-
- viewOn?: string;
-
- pipeline?: Document[];
-
- pkFactory?: PkFactory;
-
- timeseries?: TimeSeriesCollectionOptions;
-
- clusteredIndex?: ClusteredCollectionOptions;
-
- expireAfterSeconds?: number;
-
- encryptedFields?: Document;
-
- changeStreamPreAndPostImages?: {
- enabled: boolean;
- };
- }
- export declare interface CreateIndexesOptions extends Omit<CommandOperationOptions, 'writeConcern'> {
-
- background?: boolean;
-
- unique?: boolean;
-
- name?: string;
-
- partialFilterExpression?: Document;
-
- sparse?: boolean;
-
- expireAfterSeconds?: number;
-
- storageEngine?: Document;
-
- commitQuorum?: number | string;
-
- version?: number;
- weights?: Document;
- default_language?: string;
- language_override?: string;
- textIndexVersion?: number;
- '2dsphereIndexVersion'?: number;
- bits?: number;
-
- min?: number;
-
- max?: number;
- bucketSize?: number;
- wildcardProjection?: Document;
-
- hidden?: boolean;
- }
- export declare const CURSOR_FLAGS: readonly ["tailable", "oplogReplay", "noCursorTimeout", "awaitData", "exhaust", "partial"];
- export declare type CursorFlag = (typeof CURSOR_FLAGS)[number];
- export declare interface CursorStreamOptions {
-
- transform?(this: void, doc: Document): Document;
- }
- export declare class Db {
-
-
- static SYSTEM_NAMESPACE_COLLECTION: string;
- static SYSTEM_INDEX_COLLECTION: string;
- static SYSTEM_PROFILE_COLLECTION: string;
- static SYSTEM_USER_COLLECTION: string;
- static SYSTEM_COMMAND_COLLECTION: string;
- static SYSTEM_JS_COLLECTION: string;
-
- constructor(client: MongoClient, databaseName: string, options?: DbOptions);
- get databaseName(): string;
- get options(): DbOptions | undefined;
-
- get secondaryOk(): boolean;
- get readConcern(): ReadConcern | undefined;
-
- get readPreference(): ReadPreference;
- get bsonOptions(): BSONSerializeOptions;
- get writeConcern(): WriteConcern | undefined;
- get namespace(): string;
-
- createCollection<TSchema extends Document = Document>(name: string, options?: CreateCollectionOptions): Promise<Collection<TSchema>>;
-
- command(command: Document, options?: RunCommandOptions): Promise<Document>;
-
- aggregate<T extends Document = Document>(pipeline?: Document[], options?: AggregateOptions): AggregationCursor<T>;
-
- admin(): Admin;
-
- collection<TSchema extends Document = Document>(name: string, options?: CollectionOptions): Collection<TSchema>;
-
- stats(options?: DbStatsOptions): Promise<Document>;
-
- listCollections(filter: Document, options: Exclude<ListCollectionsOptions, 'nameOnly'> & {
- nameOnly: true;
- }): ListCollectionsCursor<Pick<CollectionInfo, 'name' | 'type'>>;
- listCollections(filter: Document, options: Exclude<ListCollectionsOptions, 'nameOnly'> & {
- nameOnly: false;
- }): ListCollectionsCursor<CollectionInfo>;
- listCollections<T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo = Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo>(filter?: Document, options?: ListCollectionsOptions): ListCollectionsCursor<T>;
-
- renameCollection<TSchema extends Document = Document>(fromCollection: string, toCollection: string, options?: RenameOptions): Promise<Collection<TSchema>>;
-
- dropCollection(name: string, options?: DropCollectionOptions): Promise<boolean>;
-
- dropDatabase(options?: DropDatabaseOptions): Promise<boolean>;
-
- collections(options?: ListCollectionsOptions): Promise<Collection[]>;
-
- createIndex(name: string, indexSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
-
- addUser(username: string, passwordOrOptions?: string | AddUserOptions, options?: AddUserOptions): Promise<Document>;
-
- removeUser(username: string, options?: RemoveUserOptions): Promise<boolean>;
-
- setProfilingLevel(level: ProfilingLevel, options?: SetProfilingLevelOptions): Promise<ProfilingLevel>;
-
- profilingLevel(options?: ProfilingLevelOptions): Promise<string>;
-
- indexInformation(name: string, options?: IndexInformationOptions): Promise<Document>;
-
- watch<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>>(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream<TSchema, TChange>;
-
- runCursorCommand(command: Document, options?: RunCursorCommandOptions): RunCommandCursor;
- }
- export declare interface DbOptions extends BSONSerializeOptions, WriteConcernOptions {
-
- authSource?: string;
-
- forceServerObjectId?: boolean;
-
- readPreference?: ReadPreferenceLike;
-
- pkFactory?: PkFactory;
-
- readConcern?: ReadConcern;
-
- retryWrites?: boolean;
- }
- export { DBRef }
- export declare interface DbStatsOptions extends CommandOperationOptions {
-
- scale?: number;
- }
- export { Decimal128 }
- export declare interface DeleteManyModel<TSchema extends Document = Document> {
-
- filter: Filter<TSchema>;
-
- collation?: CollationOptions;
-
- hint?: Hint;
- }
- export declare interface DeleteOneModel<TSchema extends Document = Document> {
-
- filter: Filter<TSchema>;
-
- collation?: CollationOptions;
-
- hint?: Hint;
- }
- export declare interface DeleteOptions extends CommandOperationOptions, WriteConcernOptions {
-
- ordered?: boolean;
-
- collation?: CollationOptions;
-
- hint?: string | Document;
-
- let?: Document;
- }
- export declare interface DeleteResult {
-
- acknowledged: boolean;
-
- deletedCount: number;
- }
- export declare interface DeleteStatement {
-
- q: Document;
-
- limit: number;
-
- collation?: CollationOptions;
-
- hint?: Hint;
- }
- export { deserialize }
- export declare type DistinctOptions = CommandOperationOptions;
- export { Document }
- export { Double }
- export declare interface DriverInfo {
- name?: string;
- version?: string;
- platform?: string;
- }
- export declare interface DropCollectionOptions extends CommandOperationOptions {
-
- encryptedFields?: Document;
- }
- export declare type DropDatabaseOptions = CommandOperationOptions;
- export declare type DropIndexesOptions = CommandOperationOptions;
- export declare interface EndSessionOptions {
-
- force?: boolean;
- forceClear?: boolean;
- }
- export declare type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion ? TRecordOrUnion : TRecordOrUnion extends any ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>> : never;
- export declare interface ErrorDescription extends Document {
- message?: string;
- errmsg?: string;
- $err?: string;
- errorLabels?: string[];
- errInfo?: Document;
- }
- export declare interface EstimatedDocumentCountOptions extends CommandOperationOptions {
-
- maxTimeMS?: number;
- }
- export declare interface EvalOptions extends CommandOperationOptions {
- nolock?: boolean;
- }
- export declare type EventEmitterWithState = {
-
- };
- export declare type EventsDescription = Record<string, GenericListener>;
- export declare interface ExplainOptions {
-
- explain?: ExplainVerbosityLike;
- }
- export declare const ExplainVerbosity: Readonly<{
- readonly queryPlanner: "queryPlanner";
- readonly queryPlannerExtended: "queryPlannerExtended";
- readonly executionStats: "executionStats";
- readonly allPlansExecution: "allPlansExecution";
- }>;
- export declare type ExplainVerbosity = string;
- export declare type ExplainVerbosityLike = ExplainVerbosity | boolean;
- export declare type Filter<TSchema> = {
- [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]>;
- } & RootFilterOperators<WithId<TSchema>>;
- export declare type FilterOperations<T> = T extends Record<string, any> ? {
- [key in keyof T]?: FilterOperators<T[key]>;
- } : FilterOperators<T>;
- export declare interface FilterOperators<TValue> extends NonObjectIdLikeDocument {
- $eq?: TValue;
- $gt?: TValue;
- $gte?: TValue;
- $in?: ReadonlyArray<TValue>;
- $lt?: TValue;
- $lte?: TValue;
- $ne?: TValue;
- $nin?: ReadonlyArray<TValue>;
- $not?: TValue extends string ? FilterOperators<TValue> | RegExp : FilterOperators<TValue>;
-
- $exists?: boolean;
- $type?: BSONType | BSONTypeAlias;
- $expr?: Record<string, any>;
- $jsonSchema?: Record<string, any>;
- $mod?: TValue extends number ? [number, number] : never;
- $regex?: TValue extends string ? RegExp | BSONRegExp | string : never;
- $options?: TValue extends string ? string : never;
- $geoIntersects?: {
- $geometry: Document;
- };
- $geoWithin?: Document;
- $near?: Document;
- $nearSphere?: Document;
- $maxDistance?: number;
- $all?: ReadonlyArray<any>;
- $elemMatch?: Document;
- $size?: TValue extends ReadonlyArray<any> ? number : never;
- $bitsAllClear?: BitwiseFilter;
- $bitsAllSet?: BitwiseFilter;
- $bitsAnyClear?: BitwiseFilter;
- $bitsAnySet?: BitwiseFilter;
- $rand?: Record<string, never>;
- }
- export declare class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
-
-
-
-
- clone(): FindCursor<TSchema>;
- map<T>(transform: (doc: TSchema) => T): FindCursor<T>;
-
-
-
- count(options?: CountOptions): Promise<number>;
-
- explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
-
- filter(filter: Document): this;
-
- hint(hint: Hint): this;
-
- min(min: Document): this;
-
- max(max: Document): this;
-
- returnKey(value: boolean): this;
-
- showRecordId(value: boolean): this;
-
- addQueryModifier(name: string, value: string | boolean | number | Document): this;
-
- comment(value: string): this;
-
- maxAwaitTimeMS(value: number): this;
-
- maxTimeMS(value: number): this;
-
- project<T extends Document = Document>(value: Document): FindCursor<T>;
-
- sort(sort: Sort | string, direction?: SortDirection): this;
-
- allowDiskUse(allow?: boolean): this;
-
- collation(value: CollationOptions): this;
-
- limit(value: number): this;
-
- skip(value: number): this;
- }
- export declare interface FindOneAndDeleteOptions extends CommandOperationOptions {
-
- hint?: Document;
-
- projection?: Document;
-
- sort?: Sort;
-
- let?: Document;
-
- includeResultMetadata?: boolean;
- }
- export declare interface FindOneAndReplaceOptions extends CommandOperationOptions {
-
- bypassDocumentValidation?: boolean;
-
- hint?: Document;
-
- projection?: Document;
-
- returnDocument?: ReturnDocument;
-
- sort?: Sort;
-
- upsert?: boolean;
-
- let?: Document;
-
- includeResultMetadata?: boolean;
- }
- export declare interface FindOneAndUpdateOptions extends CommandOperationOptions {
-
- arrayFilters?: Document[];
-
- bypassDocumentValidation?: boolean;
-
- hint?: Document;
-
- projection?: Document;
-
- returnDocument?: ReturnDocument;
-
- sort?: Sort;
-
- upsert?: boolean;
-
- let?: Document;
-
- includeResultMetadata?: boolean;
- }
- export declare class FindOperators {
- bulkOperation: BulkOperationBase;
-
-
- update(updateDocument: Document | Document[]): BulkOperationBase;
-
- updateOne(updateDocument: Document | Document[]): BulkOperationBase;
-
- replaceOne(replacement: Document): BulkOperationBase;
-
- deleteOne(): BulkOperationBase;
-
- delete(): BulkOperationBase;
-
- upsert(): this;
-
- collation(collation: CollationOptions): this;
-
- arrayFilters(arrayFilters: Document[]): this;
-
- hint(hint: Hint): this;
- }
- export declare interface FindOptions<TSchema extends Document = Document> extends Omit<CommandOperationOptions, 'writeConcern'> {
-
- limit?: number;
-
- sort?: Sort;
-
- projection?: Document;
-
- skip?: number;
-
- hint?: Hint;
-
- timeout?: boolean;
-
- tailable?: boolean;
-
- awaitData?: boolean;
-
- batchSize?: number;
-
- returnKey?: boolean;
-
- min?: Document;
-
- max?: Document;
-
- maxTimeMS?: number;
-
- maxAwaitTimeMS?: number;
-
- noCursorTimeout?: boolean;
-
- collation?: CollationOptions;
-
- allowDiskUse?: boolean;
-
- singleBatch?: boolean;
-
- allowPartialResults?: boolean;
-
- showRecordId?: boolean;
-
- let?: Document;
-
- oplogReplay?: boolean;
- }
- export declare type Flatten<Type> = Type extends ReadonlyArray<infer Item> ? Item : Type;
- export declare type GenericListener = (...args: any[]) => void;
- export declare class GridFSBucket extends TypedEventEmitter<GridFSBucketEvents> {
-
-
- static readonly INDEX: "index";
- constructor(db: Db, options?: GridFSBucketOptions);
-
- openUploadStream(filename: string, options?: GridFSBucketWriteStreamOptions): GridFSBucketWriteStream;
-
- openUploadStreamWithId(id: ObjectId, filename: string, options?: GridFSBucketWriteStreamOptions): GridFSBucketWriteStream;
-
- openDownloadStream(id: ObjectId, options?: GridFSBucketReadStreamOptions): GridFSBucketReadStream;
-
- delete(id: ObjectId): Promise<void>;
-
- find(filter?: Filter<GridFSFile>, options?: FindOptions): FindCursor<GridFSFile>;
-
- openDownloadStreamByName(filename: string, options?: GridFSBucketReadStreamOptionsWithRevision): GridFSBucketReadStream;
-
- rename(id: ObjectId, filename: string): Promise<void>;
-
- drop(): Promise<void>;
- }
- export declare type GridFSBucketEvents = {
- index(): void;
- };
- export declare interface GridFSBucketOptions extends WriteConcernOptions {
-
- bucketName?: string;
-
- chunkSizeBytes?: number;
-
- readPreference?: ReadPreference;
- }
- export declare class GridFSBucketReadStream extends Readable implements NodeJS.ReadableStream {
-
-
- static readonly ERROR: "error";
-
- static readonly FILE: "file";
-
- static readonly DATA: "data";
-
- static readonly END: "end";
-
- static readonly CLOSE: "close";
-
-
-
- start(start?: number): this;
-
- end(end?: number): this;
-
- abort(): Promise<void>;
- }
- export declare interface GridFSBucketReadStreamOptions {
- sort?: Sort;
- skip?: number;
-
- start?: number;
-
- end?: number;
- }
- export declare interface GridFSBucketReadStreamOptionsWithRevision extends GridFSBucketReadStreamOptions {
-
- revision?: number;
- }
- export declare class GridFSBucketWriteStream extends Writable implements NodeJS.WritableStream {
- bucket: GridFSBucket;
- chunks: Collection<GridFSChunk>;
- filename: string;
- files: Collection<GridFSFile>;
- options: GridFSBucketWriteStreamOptions;
- done: boolean;
- id: ObjectId;
- chunkSizeBytes: number;
- bufToStore: Buffer;
- length: number;
- n: number;
- pos: number;
- state: {
- streamEnd: boolean;
- outstandingRequests: number;
- errored: boolean;
- aborted: boolean;
- };
- writeConcern?: WriteConcern;
-
- static readonly CLOSE = "close";
-
- static readonly ERROR = "error";
-
- static readonly FINISH = "finish";
-
-
- write(chunk: Buffer | string): boolean;
- write(chunk: Buffer | string, callback: Callback<void>): boolean;
- write(chunk: Buffer | string, encoding: BufferEncoding | undefined): boolean;
- write(chunk: Buffer | string, encoding: BufferEncoding | undefined, callback: Callback<void>): boolean;
-
- abort(): Promise<void>;
-
- end(): this;
- end(chunk: Buffer): this;
- end(callback: Callback<GridFSFile | void>): this;
- end(chunk: Buffer, callback: Callback<GridFSFile | void>): this;
- end(chunk: Buffer, encoding: BufferEncoding): this;
- end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): this;
- }
- export declare interface GridFSBucketWriteStreamOptions extends WriteConcernOptions {
-
- chunkSizeBytes?: number;
-
- id?: ObjectId;
-
- metadata?: Document;
-
- contentType?: string;
-
- aliases?: string[];
- }
- export declare interface GridFSChunk {
- _id: ObjectId;
- files_id: ObjectId;
- n: number;
- data: Buffer | Uint8Array;
- }
- export declare interface GridFSFile {
- _id: ObjectId;
- length: number;
- chunkSize: number;
- filename: string;
- contentType?: string;
- aliases?: string[];
- metadata?: Document;
- uploadDate: Date;
- }
- export declare const GSSAPICanonicalizationValue: Readonly<{
- readonly on: true;
- readonly off: false;
- readonly none: "none";
- readonly forward: "forward";
- readonly forwardAndReverse: "forwardAndReverse";
- }>;
- export declare type GSSAPICanonicalizationValue = (typeof GSSAPICanonicalizationValue)[keyof typeof GSSAPICanonicalizationValue];
- export declare interface HedgeOptions {
-
- enabled?: boolean;
- }
- export declare type Hint = string | Document;
- export declare class HostAddress {
- host: string | undefined;
- port: number | undefined;
- socketPath: string | undefined;
- isIPv6: boolean;
- constructor(hostString: string);
- inspect(): string;
- toString(): string;
- static fromString(this: void, s: string): HostAddress;
- static fromHostPort(host: string, port: number): HostAddress;
- static fromSrvRecord({ name, port }: SrvRecord): HostAddress;
- toHostPort(): {
- host: string;
- port: number;
- };
- }
- export declare interface IdPServerInfo {
- issuer: string;
- clientId: string;
- requestScopes?: string[];
- }
- export declare interface IdPServerResponse {
- accessToken: string;
- expiresInSeconds?: number;
- refreshToken?: string;
- }
- export declare interface IndexDescription extends Pick<CreateIndexesOptions, 'background' | 'unique' | 'partialFilterExpression' | 'sparse' | 'hidden' | 'expireAfterSeconds' | 'storageEngine' | 'version' | 'weights' | 'default_language' | 'language_override' | 'textIndexVersion' | '2dsphereIndexVersion' | 'bits' | 'min' | 'max' | 'bucketSize' | 'wildcardProjection'> {
- collation?: CollationOptions;
- name?: string;
- key: {
- [key: string]: IndexDirection;
- } | Map<string, IndexDirection>;
- }
- export declare type IndexDirection = -1 | 1 | '2d' | '2dsphere' | 'text' | 'geoHaystack' | 'hashed' | number;
- export declare interface IndexInformationOptions {
- full?: boolean;
- readPreference?: ReadPreference;
- session?: ClientSession;
- }
- export declare type IndexSpecification = OneOrMore<string | [string, IndexDirection] | {
- [key: string]: IndexDirection;
- } | Map<string, IndexDirection>>;
- export declare type InferIdType<TSchema> = TSchema extends {
- _id: infer IdType;
- } ? Record<any, never> extends IdType ? never : IdType : TSchema extends {
- _id?: infer IdType;
- } ? unknown extends IdType ? ObjectId : IdType : ObjectId;
- export declare interface InsertManyResult<TSchema = Document> {
-
- acknowledged: boolean;
-
- insertedCount: number;
-
- insertedIds: {
- [key: number]: InferIdType<TSchema>;
- };
- }
- export declare interface InsertOneModel<TSchema extends Document = Document> {
-
- document: OptionalId<TSchema>;
- }
- export declare interface InsertOneOptions extends CommandOperationOptions {
-
- bypassDocumentValidation?: boolean;
-
- forceServerObjectId?: boolean;
- }
- export declare interface InsertOneResult<TSchema = Document> {
-
- acknowledged: boolean;
-
- insertedId: InferIdType<TSchema>;
- }
- export { Int32 }
- export declare type IntegerType = number | Int32 | Long | bigint;
- export declare type IsAny<Type, ResultIfAny, ResultIfNotAny> = true extends false & Type ? ResultIfAny : ResultIfNotAny;
- export declare type Join<T extends unknown[], D extends string> = T extends [] ? '' : T extends [string | number] ? `${T[0]}` : T extends [string | number, ...infer R] ? `${T[0]}${D}${Join<R, D>}` : string;
- export declare type KeysOfAType<TSchema, Type> = {
- [key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? key : never;
- }[keyof TSchema];
- export declare type KeysOfOtherType<TSchema, Type> = {
- [key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? never : key;
- }[keyof TSchema];
- export declare const LEGAL_TCP_SOCKET_OPTIONS: readonly ["family", "hints", "localAddress", "localPort", "lookup"];
- export declare const LEGAL_TLS_SOCKET_OPTIONS: readonly ["ALPNProtocols", "ca", "cert", "checkServerIdentity", "ciphers", "crl", "ecdhCurve", "key", "minDHSize", "passphrase", "pfx", "rejectUnauthorized", "secureContext", "secureProtocol", "servername", "session"];
- export declare class ListCollectionsCursor<T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo = Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo> extends AbstractCursor<T> {
- parent: Db;
- filter: Document;
- options?: ListCollectionsOptions;
- constructor(db: Db, filter: Document, options?: ListCollectionsOptions);
- clone(): ListCollectionsCursor<T>;
-
- }
- export declare interface ListCollectionsOptions extends Omit<CommandOperationOptions, 'writeConcern'> {
-
- nameOnly?: boolean;
-
- authorizedCollections?: boolean;
-
- batchSize?: number;
- }
- export declare interface ListDatabasesOptions extends CommandOperationOptions {
-
- filter?: Document;
-
- nameOnly?: boolean;
-
- authorizedDatabases?: boolean;
- }
- export declare interface ListDatabasesResult {
- databases: ({
- name: string;
- sizeOnDisk?: number;
- empty?: boolean;
- } & Document)[];
- totalSize?: number;
- totalSizeMb?: number;
- ok: 1 | 0;
- }
- export declare class ListIndexesCursor extends AbstractCursor {
- parent: Collection;
- options?: ListIndexesOptions;
- constructor(collection: Collection, options?: ListIndexesOptions);
- clone(): ListIndexesCursor;
-
- }
- export declare interface ListIndexesOptions extends Omit<CommandOperationOptions, 'writeConcern'> {
-
- batchSize?: number;
- }
- export declare class ListSearchIndexesCursor extends AggregationCursor<{
- name: string;
- }> {
-
- }
- export declare type ListSearchIndexesOptions = AggregateOptions;
- export { Long }
- export declare type MatchKeysAndValues<TSchema> = Readonly<Partial<TSchema>> & Record<string, any>;
- export { MaxKey }
- export { MinKey }
- export declare interface ModifyResult<TSchema = Document> {
- value: WithId<TSchema> | null;
- lastErrorObject?: Document;
- ok: 0 | 1;
- }
- export declare const MONGO_CLIENT_EVENTS: 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"];
- export declare class MongoAPIError extends MongoDriverError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoAWSError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoAzureError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoBatchReExecutionError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoBulkWriteError extends MongoServerError {
- result: BulkWriteResult;
- writeErrors: OneOrMore<WriteError>;
- err?: WriteConcernError;
-
- constructor(error: {
- message: string;
- code: number;
- writeErrors?: WriteError[];
- } | WriteConcernError | AnyError, result: BulkWriteResult);
- get name(): string;
-
- get insertedCount(): number;
-
- get matchedCount(): number;
-
- get modifiedCount(): number;
-
- get deletedCount(): number;
-
- get upsertedCount(): number;
-
- get insertedIds(): {
- [key: number]: any;
- };
-
- get upsertedIds(): {
- [key: number]: any;
- };
- }
- export declare class MongoChangeStreamError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> {
-
-
-
-
-
- constructor(url: string, options?: MongoClientOptions);
-
- get options(): Readonly<MongoOptions>;
- get serverApi(): Readonly<ServerApi | undefined>;
-
-
-
- get autoEncrypter(): AutoEncrypter | undefined;
- get readConcern(): ReadConcern | undefined;
- get writeConcern(): WriteConcern | undefined;
- get readPreference(): ReadPreference;
- get bsonOptions(): BSONSerializeOptions;
-
- connect(): Promise<this>;
-
-
- close(force?: boolean): Promise<void>;
-
- db(dbName?: string, options?: DbOptions): Db;
-
- static connect(url: string, options?: MongoClientOptions): Promise<MongoClient>;
-
- startSession(options?: ClientSessionOptions): ClientSession;
-
- withSession(callback: WithSessionCallback): Promise<void>;
- withSession(options: ClientSessionOptions, callback: WithSessionCallback): Promise<void>;
-
- watch<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>>(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream<TSchema, TChange>;
- }
- export declare type MongoClientEvents = Pick<TopologyEvents, (typeof MONGO_CLIENT_EVENTS)[number]> & {
- open(mongoClient: MongoClient): void;
- };
- export declare interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeConnectionOptions {
-
- replicaSet?: string;
-
- tls?: boolean;
-
- ssl?: boolean;
-
- tlsCertificateFile?: string;
-
- tlsCertificateKeyFile?: string;
-
- tlsCertificateKeyFilePassword?: string;
-
- tlsCAFile?: string;
-
- tlsAllowInvalidCertificates?: boolean;
-
- tlsAllowInvalidHostnames?: boolean;
-
- tlsInsecure?: boolean;
-
- connectTimeoutMS?: number;
-
- socketTimeoutMS?: number;
-
- compressors?: CompressorName[] | string;
-
- zlibCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
-
- srvMaxHosts?: number;
-
- srvServiceName?: string;
-
- maxPoolSize?: number;
-
- minPoolSize?: number;
-
- maxConnecting?: number;
-
- maxIdleTimeMS?: number;
-
- waitQueueTimeoutMS?: number;
-
- readConcern?: ReadConcernLike;
-
- readConcernLevel?: ReadConcernLevel;
-
- readPreference?: ReadPreferenceMode | ReadPreference;
-
- maxStalenessSeconds?: number;
-
- readPreferenceTags?: TagSet[];
-
- auth?: Auth;
-
- authSource?: string;
-
- authMechanism?: AuthMechanism;
-
- authMechanismProperties?: AuthMechanismProperties;
-
- localThresholdMS?: number;
-
- serverSelectionTimeoutMS?: number;
-
- heartbeatFrequencyMS?: number;
-
- minHeartbeatFrequencyMS?: number;
-
- appName?: string;
-
- retryReads?: boolean;
-
- retryWrites?: boolean;
-
- directConnection?: boolean;
-
- loadBalanced?: boolean;
-
- w?: W;
-
- wtimeoutMS?: number;
-
- journal?: boolean;
-
- writeConcern?: WriteConcern | WriteConcernSettings;
-
- sslValidate?: boolean;
-
- sslCA?: string;
-
- sslCert?: string;
-
- sslKey?: string;
-
- sslPass?: string;
-
- sslCRL?: string;
-
- noDelay?: boolean;
-
- keepAlive?: boolean;
-
- keepAliveInitialDelay?: number;
-
- forceServerObjectId?: boolean;
-
- pkFactory?: PkFactory;
-
- monitorCommands?: boolean;
-
- serverApi?: ServerApi | ServerApiVersion;
-
- autoEncryption?: AutoEncryptionOptions;
-
- driverInfo?: DriverInfo;
-
- proxyHost?: string;
-
- proxyPort?: number;
-
- proxyUsername?: string;
-
- proxyPassword?: string;
-
-
-
- }
- export declare class MongoCompatibilityError extends MongoAPIError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoCredentials {
-
- readonly username: string;
-
- readonly password: string;
-
- readonly source: string;
-
- readonly mechanism: AuthMechanism;
-
- readonly mechanismProperties: AuthMechanismProperties;
- constructor(options: MongoCredentialsOptions);
-
- equals(other: MongoCredentials): boolean;
-
- resolveAuthMechanism(hello?: Document): MongoCredentials;
- validate(): void;
- static merge(creds: MongoCredentials | undefined, options: Partial<MongoCredentialsOptions>): MongoCredentials;
- }
- export declare interface MongoCredentialsOptions {
- username?: string;
- password: string;
- source: string;
- db?: string;
- mechanism?: AuthMechanism;
- mechanismProperties: AuthMechanismProperties;
- }
- export declare class MongoCursorExhaustedError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoCursorInUseError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoDBCollectionNamespace extends MongoDBNamespace {
- collection: string;
- constructor(db: string, collection: string);
- }
- export declare class MongoDBNamespace {
- db: string;
- collection?: string | undefined;
-
- constructor(db: string, collection?: string | undefined);
- toString(): string;
- withCollection(collection: string): MongoDBCollectionNamespace;
- static fromString(namespace?: string): MongoDBNamespace;
- }
- export declare class MongoDecompressionError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoDriverError extends MongoError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoError extends Error {
-
-
- code?: number | string;
- topologyVersion?: TopologyVersion;
- connectionGeneration?: number;
- cause?: Error;
- constructor(message: string | Error);
-
- get name(): string;
-
- get errmsg(): string;
-
- hasErrorLabel(label: string): boolean;
- addErrorLabel(label: string): void;
- get errorLabels(): string[];
- }
- export declare const MongoErrorLabel: Readonly<{
- readonly RetryableWriteError: "RetryableWriteError";
- readonly TransientTransactionError: "TransientTransactionError";
- readonly UnknownTransactionCommitResult: "UnknownTransactionCommitResult";
- readonly ResumableChangeStreamError: "ResumableChangeStreamError";
- readonly HandshakeError: "HandshakeError";
- readonly ResetPool: "ResetPool";
- readonly InterruptInUseConnections: "InterruptInUseConnections";
- readonly NoWritesPerformed: "NoWritesPerformed";
- }>;
- export declare type MongoErrorLabel = (typeof MongoErrorLabel)[keyof typeof MongoErrorLabel];
- export declare class MongoExpiredSessionError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoGridFSChunkError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoGridFSStreamError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoInvalidArgumentError extends MongoAPIError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoKerberosError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoMissingCredentialsError extends MongoAPIError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoMissingDependencyError extends MongoAPIError {
- constructor(message: string, { cause }?: {
- cause?: Error;
- });
- get name(): string;
- }
- export declare class MongoNetworkError extends MongoError {
-
- constructor(message: string | Error, options?: MongoNetworkErrorOptions);
- get name(): string;
- }
- export declare interface MongoNetworkErrorOptions {
-
- beforeHandshake: boolean;
- }
- export declare class MongoNetworkTimeoutError extends MongoNetworkError {
- constructor(message: string, options?: MongoNetworkErrorOptions);
- get name(): string;
- }
- export declare class MongoNotConnectedError extends MongoAPIError {
- constructor(message: string);
- get name(): string;
- }
- export declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEncryption' | 'connectTimeoutMS' | 'directConnection' | 'driverInfo' | 'forceServerObjectId' | 'minHeartbeatFrequencyMS' | 'heartbeatFrequencyMS' | 'keepAlive' | 'keepAliveInitialDelay' | 'localThresholdMS' | 'maxConnecting' | 'maxIdleTimeMS' | 'maxPoolSize' | 'minPoolSize' | 'monitorCommands' | 'noDelay' | 'pkFactory' | 'raw' | 'replicaSet' | 'retryReads' | 'retryWrites' | 'serverSelectionTimeoutMS' | 'socketTimeoutMS' | 'srvMaxHosts' | 'srvServiceName' | 'tlsAllowInvalidCertificates' | 'tlsAllowInvalidHostnames' | 'tlsInsecure' | 'waitQueueTimeoutMS' | 'zlibCompressionLevel'>>, SupportedNodeConnectionOptions {
- appName?: string;
- hosts: HostAddress[];
- srvHost?: string;
- credentials?: MongoCredentials;
- readPreference: ReadPreference;
- readConcern: ReadConcern;
- loadBalanced: boolean;
- serverApi: ServerApi;
- compressors: CompressorName[];
- writeConcern: WriteConcern;
- dbName: string;
- metadata: ClientMetadata;
-
- autoEncrypter?: AutoEncrypter;
- proxyHost?: string;
- proxyPort?: number;
- proxyUsername?: string;
- proxyPassword?: string;
-
-
-
-
-
- tls: boolean;
-
-
- }
- export declare class MongoParseError extends MongoDriverError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoRuntimeError extends MongoDriverError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoServerClosedError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoServerError extends MongoError {
- codeName?: string;
- writeConcernError?: Document;
- errInfo?: Document;
- ok?: number;
- [key: string]: any;
- constructor(message: ErrorDescription);
- get name(): string;
- }
- export declare class MongoServerSelectionError extends MongoSystemError {
- constructor(message: string, reason: TopologyDescription);
- get name(): string;
- }
- export declare class MongoSystemError extends MongoError {
-
- reason?: TopologyDescription;
- constructor(message: string, reason: TopologyDescription);
- get name(): string;
- }
- export declare class MongoTailableCursorError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoTopologyClosedError extends MongoAPIError {
- constructor(message?: string);
- get name(): string;
- }
- export declare class MongoTransactionError extends MongoAPIError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoUnexpectedServerResponseError extends MongoRuntimeError {
- constructor(message: string);
- get name(): string;
- }
- export declare class MongoWriteConcernError extends MongoServerError {
-
- result?: Document;
- constructor(message: ErrorDescription, result?: Document);
- get name(): string;
- }
- export declare type MonitorEvents = {
- serverHeartbeatStarted(event: ServerHeartbeatStartedEvent): void;
- serverHeartbeatSucceeded(event: ServerHeartbeatSucceededEvent): void;
- serverHeartbeatFailed(event: ServerHeartbeatFailedEvent): void;
- resetServer(error?: MongoError): void;
- resetConnectionPool(): void;
- close(): void;
- } & EventEmitterWithState;
- export declare interface MonitorOptions extends Omit<ConnectionOptions, 'id' | 'generation' | 'hostAddress'> {
- connectTimeoutMS: number;
- heartbeatFrequencyMS: number;
- minHeartbeatFrequencyMS: number;
- }
- export declare type NestedPaths<Type, Depth extends number[]> = 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>] : [];
- export declare type NestedPathsOfType<TSchema, Type> = KeysOfAType<{
- [Property in Join<NestedPaths<TSchema, []>, '.'>]: PropertyType<TSchema, Property>;
- }, Type>;
- export declare type NonObjectIdLikeDocument = {
- [key in keyof ObjectIdLike]?: never;
- } & Document;
- export declare type NotAcceptedFields<TSchema, FieldType> = {
- readonly [key in KeysOfOtherType<TSchema, FieldType>]?: never;
- };
- export declare type NumericType = IntegerType | Decimal128 | Double;
- export { ObjectId }
- export declare interface OIDCCallbackContext {
- refreshToken?: string;
- timeoutSeconds?: number;
- timeoutContext?: AbortSignal;
- version: number;
- }
- export declare type OIDCRefreshFunction = (info: IdPServerInfo, context: OIDCCallbackContext) => Promise<IdPServerResponse>;
- export declare type OIDCRequestFunction = (info: IdPServerInfo, context: OIDCCallbackContext) => Promise<IdPServerResponse>;
- export declare type OneOrMore<T> = T | ReadonlyArray<T>;
- export declare type OnlyFieldsOfType<TSchema, FieldType = any, AssignableType = FieldType> = IsAny<TSchema[keyof TSchema], Record<string, FieldType>, AcceptedFields<TSchema, FieldType, AssignableType> & NotAcceptedFields<TSchema, FieldType> & Record<string, AssignableType>>;
- export declare interface OperationOptions extends BSONSerializeOptions {
-
- session?: ClientSession;
- willRetryWrite?: boolean;
-
- readPreference?: ReadPreferenceLike;
-
- omitReadPreference?: boolean;
- }
- export declare type OperationTime = Timestamp;
- export declare type OptionalId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
- _id?: InferIdType<TSchema>;
- };
- export declare type OptionalUnlessRequiredId<TSchema> = TSchema extends {
- _id: any;
- } ? TSchema : OptionalId<TSchema>;
- export declare class OrderedBulkOperation extends BulkOperationBase {
-
- addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
- }
- export declare interface PkFactory {
- createPk(): any;
- }
- export declare const ProfilingLevel: Readonly<{
- readonly off: "off";
- readonly slowOnly: "slow_only";
- readonly all: "all";
- }>;
- export declare type ProfilingLevel = (typeof ProfilingLevel)[keyof typeof ProfilingLevel];
- export declare type ProfilingLevelOptions = CommandOperationOptions;
- export declare type PropertyType<Type, Property extends string> = 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;
- export declare interface ProxyOptions {
- proxyHost?: string;
- proxyPort?: number;
- proxyUsername?: string;
- proxyPassword?: string;
- }
- export declare type PullAllOperator<TSchema> = ({
- readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: TSchema[key];
- } & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
- readonly [key: string]: ReadonlyArray<any>;
- };
- export declare type PullOperator<TSchema> = ({
- readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: Partial<Flatten<TSchema[key]>> | FilterOperations<Flatten<TSchema[key]>>;
- } & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
- readonly [key: string]: FilterOperators<any> | any;
- };
- export declare type PushOperator<TSchema> = ({
- readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: Flatten<TSchema[key]> | ArrayOperator<Array<Flatten<TSchema[key]>>>;
- } & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
- readonly [key: string]: ArrayOperator<any> | any;
- };
- export declare class ReadConcern {
- level: ReadConcernLevel | string;
-
- constructor(level: ReadConcernLevel);
-
- static fromOptions(options?: {
- readConcern?: ReadConcernLike;
- level?: ReadConcernLevel;
- }): ReadConcern | undefined;
- static get MAJORITY(): 'majority';
- static get AVAILABLE(): 'available';
- static get LINEARIZABLE(): 'linearizable';
- static get SNAPSHOT(): 'snapshot';
- toJSON(): Document;
- }
- export declare const ReadConcernLevel: Readonly<{
- readonly local: "local";
- readonly majority: "majority";
- readonly linearizable: "linearizable";
- readonly available: "available";
- readonly snapshot: "snapshot";
- }>;
- export declare type ReadConcernLevel = (typeof ReadConcernLevel)[keyof typeof ReadConcernLevel];
- export declare type ReadConcernLike = ReadConcern | {
- level: ReadConcernLevel;
- } | ReadConcernLevel;
- export declare class ReadPreference {
- mode: ReadPreferenceMode;
- tags?: TagSet[];
- hedge?: HedgeOptions;
- maxStalenessSeconds?: number;
- minWireVersion?: number;
- static PRIMARY: "primary";
- static PRIMARY_PREFERRED: "primaryPreferred";
- static SECONDARY: "secondary";
- static SECONDARY_PREFERRED: "secondaryPreferred";
- static NEAREST: "nearest";
- static primary: ReadPreference;
- static primaryPreferred: ReadPreference;
- static secondary: ReadPreference;
- static secondaryPreferred: ReadPreference;
- static nearest: ReadPreference;
-
- constructor(mode: ReadPreferenceMode, tags?: TagSet[], options?: ReadPreferenceOptions);
- get preference(): ReadPreferenceMode;
- static fromString(mode: string): ReadPreference;
-
- static fromOptions(options?: ReadPreferenceFromOptions): ReadPreference | undefined;
-
- static translate(options: ReadPreferenceLikeOptions): ReadPreferenceLikeOptions;
-
- static isValid(mode: string): boolean;
-
- isValid(mode?: string): boolean;
-
- secondaryOk(): boolean;
-
- equals(readPreference: ReadPreference): boolean;
-
- toJSON(): Document;
- }
- export declare interface ReadPreferenceFromOptions extends ReadPreferenceLikeOptions {
- session?: ClientSession;
- readPreferenceTags?: TagSet[];
- hedge?: HedgeOptions;
- }
- export declare type ReadPreferenceLike = ReadPreference | ReadPreferenceMode;
- export declare interface ReadPreferenceLikeOptions extends ReadPreferenceOptions {
- readPreference?: ReadPreferenceLike | {
- mode?: ReadPreferenceMode;
- preference?: ReadPreferenceMode;
- tags?: TagSet[];
- maxStalenessSeconds?: number;
- };
- }
- export declare const ReadPreferenceMode: Readonly<{
- readonly primary: "primary";
- readonly primaryPreferred: "primaryPreferred";
- readonly secondary: "secondary";
- readonly secondaryPreferred: "secondaryPreferred";
- readonly nearest: "nearest";
- }>;
- export declare type ReadPreferenceMode = (typeof ReadPreferenceMode)[keyof typeof ReadPreferenceMode];
- export declare interface ReadPreferenceOptions {
-
- maxStalenessSeconds?: number;
-
- hedge?: HedgeOptions;
- }
- export declare type RegExpOrString<T> = T extends string ? BSONRegExp | RegExp | T : T;
- export declare type RemoveUserOptions = CommandOperationOptions;
- export declare interface RenameOptions extends CommandOperationOptions {
-
- dropTarget?: boolean;
-
- new_collection?: boolean;
- }
- export declare interface ReplaceOneModel<TSchema extends Document = Document> {
-
- filter: Filter<TSchema>;
-
- replacement: WithoutId<TSchema>;
-
- collation?: CollationOptions;
-
- hint?: Hint;
-
- upsert?: boolean;
- }
- export declare interface ReplaceOptions extends CommandOperationOptions {
-
- bypassDocumentValidation?: boolean;
-
- collation?: CollationOptions;
-
- hint?: string | Document;
-
- upsert?: boolean;
-
- let?: Document;
- }
- export declare interface ResumeOptions {
- startAtOperationTime?: Timestamp;
- batchSize?: number;
- maxAwaitTimeMS?: number;
- collation?: CollationOptions;
- readPreference?: ReadPreference;
- resumeAfter?: ResumeToken;
- startAfter?: ResumeToken;
- fullDocument?: string;
- }
- export declare type ResumeToken = unknown;
- export declare const ReturnDocument: Readonly<{
- readonly BEFORE: "before";
- readonly AFTER: "after";
- }>;
- export declare type ReturnDocument = (typeof ReturnDocument)[keyof typeof ReturnDocument];
- export declare interface RoleSpecification {
-
- role: string;
-
- db: string;
- }
- export declare interface RootFilterOperators<TSchema> extends Document {
- $and?: Filter<TSchema>[];
- $nor?: Filter<TSchema>[];
- $or?: Filter<TSchema>[];
- $text?: {
- $search: string;
- $language?: string;
- $caseSensitive?: boolean;
- $diacriticSensitive?: boolean;
- };
- $where?: string | ((this: TSchema) => boolean);
- $comment?: string | Document;
- }
- export declare class RunCommandCursor extends AbstractCursor {
- readonly command: Readonly<Record<string, any>>;
- readonly getMoreOptions: {
- comment?: any;
- maxAwaitTimeMS?: number;
- batchSize?: number;
- };
-
- setComment(comment: any): this;
-
- setMaxTimeMS(maxTimeMS: number): this;
-
- setBatchSize(batchSize: number): this;
-
- clone(): never;
-
- withReadConcern(_: ReadConcernLike): never;
-
- addCursorFlag(_: string, __: boolean): never;
-
- maxTimeMS(_: number): never;
-
- batchSize(_: number): never;
-
-
-
-
- }
- export declare type RunCommandOptions = {
-
- session?: ClientSession;
-
- readPreference?: ReadPreferenceLike;
-
- willRetryWrite?: any;
-
- omitReadPreference?: any;
-
- writeConcern?: any;
-
- explain?: any;
-
- readConcern?: any;
-
- collation?: any;
-
- maxTimeMS?: any;
-
- comment?: any;
-
- retryWrites?: any;
-
- dbName?: any;
-
- authdb?: any;
-
- noResponse?: any;
-
- } & BSONSerializeOptions;
- export declare type RunCursorCommandOptions = {
- readPreference?: ReadPreferenceLike;
- session?: ClientSession;
- } & BSONSerializeOptions;
- export declare type SchemaMember<T, V> = {
- [P in keyof T]?: V;
- } | {
- [key: string]: V;
- };
- export declare interface SearchIndexDescription {
-
- name?: string;
-
- definition: Document;
- }
- export declare interface SelectServerOptions {
- readPreference?: ReadPreferenceLike;
-
- serverSelectionTimeoutMS?: number;
- session?: ClientSession;
- }
- export { serialize }
- export declare interface ServerApi {
- version: ServerApiVersion;
- strict?: boolean;
- deprecationErrors?: boolean;
- }
- export declare const ServerApiVersion: Readonly<{
- readonly v1: "1";
- }>;
- export declare type ServerApiVersion = (typeof ServerApiVersion)[keyof typeof ServerApiVersion];
- export declare class ServerCapabilities {
- maxWireVersion: number;
- minWireVersion: number;
- constructor(hello: Document);
- get hasAggregationCursor(): boolean;
- get hasWriteCommands(): boolean;
- get hasTextSearch(): boolean;
- get hasAuthCommands(): boolean;
- get hasListCollectionsCommand(): boolean;
- get hasListIndexesCommand(): boolean;
- get supportsSnapshotReads(): boolean;
- get commandsTakeWriteConcern(): boolean;
- get commandsTakeCollation(): boolean;
- }
- export declare class ServerClosedEvent {
-
- topologyId: number;
-
- address: string;
-
- }
- export declare class ServerDescription {
- address: string;
- type: ServerType;
- hosts: string[];
- passives: string[];
- arbiters: string[];
- tags: TagSet;
- error: MongoError | null;
- topologyVersion: TopologyVersion | null;
- minWireVersion: number;
- maxWireVersion: number;
- roundTripTime: number;
- lastUpdateTime: number;
- lastWriteDate: number;
- me: string | null;
- primary: string | null;
- setName: string | null;
- setVersion: number | null;
- electionId: ObjectId | null;
- logicalSessionTimeoutMinutes: number | null;
- $clusterTime?: ClusterTime;
-
- get hostAddress(): HostAddress;
- get allHosts(): string[];
-
- get isReadable(): boolean;
-
- get isDataBearing(): boolean;
-
- get isWritable(): boolean;
- get host(): string;
- get port(): number;
-
- equals(other?: ServerDescription | null): boolean;
- }
- export declare class ServerDescriptionChangedEvent {
-
- topologyId: number;
-
- address: string;
-
- previousDescription: ServerDescription;
-
- newDescription: ServerDescription;
-
- }
- export declare type ServerEvents = {
- serverHeartbeatStarted(event: ServerHeartbeatStartedEvent): void;
- serverHeartbeatSucceeded(event: ServerHeartbeatSucceededEvent): void;
- serverHeartbeatFailed(event: ServerHeartbeatFailedEvent): void;
-
- descriptionReceived(description: ServerDescription): void;
- closed(): void;
- ended(): void;
- } & ConnectionPoolEvents & EventEmitterWithState;
- export declare class ServerHeartbeatFailedEvent {
-
- connectionId: string;
-
- duration: number;
-
- failure: Error;
-
- }
- export declare class ServerHeartbeatStartedEvent {
-
- connectionId: string;
-
- }
- export declare class ServerHeartbeatSucceededEvent {
-
- connectionId: string;
-
- duration: number;
-
- reply: Document;
-
- }
- export declare class ServerOpeningEvent {
-
- topologyId: number;
-
- address: string;
-
- }
- export declare class ServerSession {
- id: ServerSessionId;
- lastUse: number;
- txnNumber: number;
- isDirty: boolean;
-
-
- hasTimedOut(sessionTimeoutMinutes: number): boolean;
-
- }
- export declare type ServerSessionId = {
- id: Binary;
- };
- export declare const ServerType: Readonly<{
- readonly Standalone: "Standalone";
- readonly Mongos: "Mongos";
- readonly PossiblePrimary: "PossiblePrimary";
- readonly RSPrimary: "RSPrimary";
- readonly RSSecondary: "RSSecondary";
- readonly RSArbiter: "RSArbiter";
- readonly RSOther: "RSOther";
- readonly RSGhost: "RSGhost";
- readonly Unknown: "Unknown";
- readonly LoadBalancer: "LoadBalancer";
- }>;
- export declare type ServerType = (typeof ServerType)[keyof typeof ServerType];
- export declare type SetFields<TSchema> = ({
- readonly [key in KeysOfAType<TSchema, ReadonlyArray<any> | undefined>]?: OptionalId<Flatten<TSchema[key]>> | AddToSetOperators<Array<OptionalId<Flatten<TSchema[key]>>>>;
- } & NotAcceptedFields<TSchema, ReadonlyArray<any> | undefined>) & {
- readonly [key: string]: AddToSetOperators<any> | any;
- };
- export declare type SetProfilingLevelOptions = CommandOperationOptions;
- export declare type Sort = string | Exclude<SortDirection, {
- $meta: string;
- }> | string[] | {
- [key: string]: SortDirection;
- } | Map<string, SortDirection> | [string, SortDirection][] | [string, SortDirection];
- export declare type SortDirection = 1 | -1 | 'asc' | 'desc' | 'ascending' | 'descending' | {
- $meta: string;
- };
- export declare type Stream = Socket | TLSSocket;
- export declare class StreamDescription {
- address: string;
- type: string;
- minWireVersion?: number;
- maxWireVersion?: number;
- maxBsonObjectSize: number;
- maxMessageSizeBytes: number;
- maxWriteBatchSize: number;
- compressors: CompressorName[];
- compressor?: CompressorName;
- logicalSessionTimeoutMinutes?: number;
- loadBalanced: boolean;
- __nodejs_mock_server__?: boolean;
- zlibCompressionLevel?: number;
- constructor(address: string, options?: StreamDescriptionOptions);
- receiveResponse(response: Document | null): void;
- }
- export declare interface StreamDescriptionOptions {
- compressors?: CompressorName[];
- logicalSessionTimeoutMinutes?: number;
- loadBalanced: boolean;
- }
- export declare type StrictFilter<TSchema> = Partial<TSchema> | ({
- [Property in Join<NestedPaths<WithId<TSchema>, []>, '.'>]?: Condition<PropertyType<WithId<TSchema>, Property>>;
- } & RootFilterOperators<WithId<TSchema>>);
- export declare type StrictMatchKeysAndValues<TSchema> = Readonly<{
- [Property in Join<NestedPaths<TSchema, []>, '.'>]?: PropertyType<TSchema, Property>;
- } & {
- [Property in `${NestedPathsOfType<TSchema, any[]>}.$${`[${string}]` | ''}`]?: ArrayElement<PropertyType<TSchema, Property extends `${infer Key}.$${string}` ? Key : never>>;
- } & {
- [Property in `${NestedPathsOfType<TSchema, Record<string, any>[]>}.$${`[${string}]` | ''}.${string}`]?: any;
- } & Document>;
- export declare type StrictUpdateFilter<TSchema> = {
- $currentDate?: OnlyFieldsOfType<TSchema, Date | Timestamp, true | {
- $type: 'date' | 'timestamp';
- }>;
- $inc?: OnlyFieldsOfType<TSchema, NumericType | undefined>;
- $min?: StrictMatchKeysAndValues<TSchema>;
- $max?: StrictMatchKeysAndValues<TSchema>;
- $mul?: OnlyFieldsOfType<TSchema, NumericType | undefined>;
- $rename?: Record<string, string>;
- $set?: StrictMatchKeysAndValues<TSchema>;
- $setOnInsert?: StrictMatchKeysAndValues<TSchema>;
- $unset?: OnlyFieldsOfType<TSchema, any, '' | true | 1>;
- $addToSet?: SetFields<TSchema>;
- $pop?: OnlyFieldsOfType<TSchema, ReadonlyArray<any>, 1 | -1>;
- $pull?: PullOperator<TSchema>;
- $push?: PushOperator<TSchema>;
- $pullAll?: PullAllOperator<TSchema>;
- $bit?: OnlyFieldsOfType<TSchema, NumericType | undefined, {
- and: IntegerType;
- } | {
- or: IntegerType;
- } | {
- xor: IntegerType;
- }>;
- } & Document;
- export declare type SupportedNodeConnectionOptions = SupportedTLSConnectionOptions & SupportedTLSSocketOptions & SupportedSocketOptions;
- export declare type SupportedSocketOptions = Pick<TcpNetConnectOpts, (typeof LEGAL_TCP_SOCKET_OPTIONS)[number]>;
- export declare type SupportedTLSConnectionOptions = Pick<ConnectionOptions_2, Extract<keyof ConnectionOptions_2, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>>;
- export declare type SupportedTLSSocketOptions = Pick<TLSSocketOptions, Extract<keyof TLSSocketOptions, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>>;
- export declare type TagSet = {
- [key: string]: string;
- };
- export declare interface TimeSeriesCollectionOptions extends Document {
- timeField: string;
- metaField?: string;
- granularity?: 'seconds' | 'minutes' | 'hours' | string;
- bucketMaxSpanSeconds?: number;
- bucketRoundingSeconds?: number;
- }
- export { Timestamp }
- export declare class TopologyClosedEvent {
-
- topologyId: number;
-
- }
- export declare class TopologyDescription {
- type: TopologyType;
- setName: string | null;
- maxSetVersion: number | null;
- maxElectionId: ObjectId | null;
- servers: Map<string, ServerDescription>;
- stale: boolean;
- compatible: boolean;
- compatibilityError?: string;
- logicalSessionTimeoutMinutes: number | null;
- heartbeatFrequencyMS: number;
- localThresholdMS: number;
- commonWireVersion: number;
-
- constructor(topologyType: TopologyType, serverDescriptions?: Map<string, ServerDescription> | null, setName?: string | null, maxSetVersion?: number | null, maxElectionId?: ObjectId | null, commonWireVersion?: number | null, options?: TopologyDescriptionOptions | null);
-
-
- get error(): MongoServerError | null;
-
- get hasKnownServers(): boolean;
-
- get hasDataBearingServers(): boolean;
-
- }
- export declare class TopologyDescriptionChangedEvent {
-
- topologyId: number;
-
- previousDescription: TopologyDescription;
-
- newDescription: TopologyDescription;
-
- }
- export declare interface TopologyDescriptionOptions {
- heartbeatFrequencyMS?: number;
- localThresholdMS?: number;
- }
- export declare type TopologyEvents = {
-
- serverOpening(event: ServerOpeningEvent): void;
- serverClosed(event: ServerClosedEvent): void;
- serverDescriptionChanged(event: ServerDescriptionChangedEvent): void;
- topologyClosed(event: TopologyClosedEvent): void;
- topologyOpening(event: TopologyOpeningEvent): void;
- topologyDescriptionChanged(event: TopologyDescriptionChangedEvent): void;
- error(error: Error): void;
-
- close(): void;
- timeout(): void;
- } & Omit<ServerEvents, 'connect'> & ConnectionPoolEvents & ConnectionEvents & EventEmitterWithState;
- export declare class TopologyOpeningEvent {
-
- topologyId: number;
-
- }
- export declare const TopologyType: Readonly<{
- readonly Single: "Single";
- readonly ReplicaSetNoPrimary: "ReplicaSetNoPrimary";
- readonly ReplicaSetWithPrimary: "ReplicaSetWithPrimary";
- readonly Sharded: "Sharded";
- readonly Unknown: "Unknown";
- readonly LoadBalanced: "LoadBalanced";
- }>;
- export declare type TopologyType = (typeof TopologyType)[keyof typeof TopologyType];
- export declare interface TopologyVersion {
- processId: ObjectId;
- counter: Long;
- }
- export declare class Transaction {
-
- options: TransactionOptions;
-
-
-
-
- get recoveryToken(): Document | undefined;
- get isPinned(): boolean;
-
- get isStarting(): boolean;
-
- get isActive(): boolean;
- get isCommitted(): boolean;
-
-
-
- }
- export declare interface TransactionOptions extends CommandOperationOptions {
-
- readConcern?: ReadConcernLike;
-
- writeConcern?: WriteConcern;
-
- readPreference?: ReadPreferenceLike;
-
- maxCommitTimeMS?: number;
- }
- export declare interface TypedEventEmitter<Events extends EventsDescription> extends EventEmitter {
- addListener<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- addListener(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- addListener(event: string | symbol, listener: GenericListener): this;
- on<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- on(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- on(event: string | symbol, listener: GenericListener): this;
- once<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- once(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- once(event: string | symbol, listener: GenericListener): this;
- removeListener<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- removeListener(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- removeListener(event: string | symbol, listener: GenericListener): this;
- off<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- off(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- off(event: string | symbol, listener: GenericListener): this;
- removeAllListeners<EventKey extends keyof Events>(event?: EventKey | CommonEvents | symbol | string): this;
- listeners<EventKey extends keyof Events>(event: EventKey | CommonEvents | symbol | string): Events[EventKey][];
- rawListeners<EventKey extends keyof Events>(event: EventKey | CommonEvents | symbol | string): Events[EventKey][];
- emit<EventKey extends keyof Events>(event: EventKey | symbol, ...args: Parameters<Events[EventKey]>): boolean;
- listenerCount<EventKey extends keyof Events>(type: EventKey | CommonEvents | symbol | string): number;
- prependListener<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- prependListener(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- prependListener(event: string | symbol, listener: GenericListener): this;
- prependOnceListener<EventKey extends keyof Events>(event: EventKey, listener: Events[EventKey]): this;
- prependOnceListener(event: CommonEvents, listener: (eventName: string | symbol, listener: GenericListener) => void): this;
- prependOnceListener(event: string | symbol, listener: GenericListener): this;
- eventNames(): string[];
- getMaxListeners(): number;
- setMaxListeners(n: number): this;
- }
- export declare class TypedEventEmitter<Events extends EventsDescription> extends EventEmitter {
-
-
-
- }
- export declare class UnorderedBulkOperation extends BulkOperationBase {
-
- handleWriteError(callback: Callback, writeResult: BulkWriteResult): boolean;
- addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
- }
- export declare interface UpdateDescription<TSchema extends Document = Document> {
-
- updatedFields?: Partial<TSchema>;
-
- removedFields?: string[];
-
- truncatedArrays?: Array<{
-
- field: string;
-
- newSize: number;
- }>;
-
- disambiguatedPaths?: Document;
- }
- export declare type UpdateFilter<TSchema> = {
- $currentDate?: OnlyFieldsOfType<TSchema, Date | Timestamp, true | {
- $type: 'date' | 'timestamp';
- }>;
- $inc?: OnlyFieldsOfType<TSchema, NumericType | undefined>;
- $min?: MatchKeysAndValues<TSchema>;
- $max?: MatchKeysAndValues<TSchema>;
- $mul?: OnlyFieldsOfType<TSchema, NumericType | undefined>;
- $rename?: Record<string, string>;
- $set?: MatchKeysAndValues<TSchema>;
- $setOnInsert?: MatchKeysAndValues<TSchema>;
- $unset?: OnlyFieldsOfType<TSchema, any, '' | true | 1>;
- $addToSet?: SetFields<TSchema>;
- $pop?: OnlyFieldsOfType<TSchema, ReadonlyArray<any>, 1 | -1>;
- $pull?: PullOperator<TSchema>;
- $push?: PushOperator<TSchema>;
- $pullAll?: PullAllOperator<TSchema>;
- $bit?: OnlyFieldsOfType<TSchema, NumericType | undefined, {
- and: IntegerType;
- } | {
- or: IntegerType;
- } | {
- xor: IntegerType;
- }>;
- } & Document;
- export declare interface UpdateManyModel<TSchema extends Document = Document> {
-
- filter: Filter<TSchema>;
-
- update: UpdateFilter<TSchema> | UpdateFilter<TSchema>[];
-
- arrayFilters?: Document[];
-
- collation?: CollationOptions;
-
- hint?: Hint;
-
- upsert?: boolean;
- }
- export declare interface UpdateOneModel<TSchema extends Document = Document> {
-
- filter: Filter<TSchema>;
-
- update: UpdateFilter<TSchema> | UpdateFilter<TSchema>[];
-
- arrayFilters?: Document[];
-
- collation?: CollationOptions;
-
- hint?: Hint;
-
- upsert?: boolean;
- }
- export declare interface UpdateOptions extends CommandOperationOptions {
-
- arrayFilters?: Document[];
-
- bypassDocumentValidation?: boolean;
-
- collation?: CollationOptions;
-
- hint?: Hint;
-
- upsert?: boolean;
-
- let?: Document;
- }
- export declare interface UpdateResult<TSchema extends Document = Document> {
-
- acknowledged: boolean;
-
- matchedCount: number;
-
- modifiedCount: number;
-
- upsertedCount: number;
-
- upsertedId: InferIdType<TSchema> | null;
- }
- export declare interface UpdateStatement {
-
- q: Document;
-
- u: Document | Document[];
-
- upsert?: boolean;
-
- multi?: boolean;
-
- collation?: CollationOptions;
-
- arrayFilters?: Document[];
-
- hint?: Hint;
- }
- export declare interface ValidateCollectionOptions extends CommandOperationOptions {
-
- background?: boolean;
- }
- export declare type W = number | 'majority';
- export declare interface WiredTigerData extends Document {
- LSM: {
- 'bloom filter false positives': number;
- 'bloom filter hits': number;
- 'bloom filter misses': number;
- 'bloom filter pages evicted from cache': number;
- 'bloom filter pages read into cache': number;
- 'bloom filters in the LSM tree': number;
- 'chunks in the LSM tree': number;
- 'highest merge generation in the LSM tree': number;
- 'queries that could have benefited from a Bloom filter that did not exist': number;
- 'sleep for LSM checkpoint throttle': number;
- 'sleep for LSM merge throttle': number;
- 'total size of bloom filters': number;
- } & Document;
- 'block-manager': {
- 'allocations requiring file extension': number;
- 'blocks allocated': number;
- 'blocks freed': number;
- 'checkpoint size': number;
- 'file allocation unit size': number;
- 'file bytes available for reuse': number;
- 'file magic number': number;
- 'file major version number': number;
- 'file size in bytes': number;
- 'minor version number': number;
- };
- btree: {
- 'btree checkpoint generation': number;
- 'column-store fixed-size leaf pages': number;
- 'column-store internal pages': number;
- 'column-store variable-size RLE encoded values': number;
- 'column-store variable-size deleted values': number;
- 'column-store variable-size leaf pages': number;
- 'fixed-record size': number;
- 'maximum internal page key size': number;
- 'maximum internal page size': number;
- 'maximum leaf page key size': number;
- 'maximum leaf page size': number;
- 'maximum leaf page value size': number;
- 'maximum tree depth': number;
- 'number of key/value pairs': number;
- 'overflow pages': number;
- 'pages rewritten by compaction': number;
- 'row-store internal pages': number;
- 'row-store leaf pages': number;
- } & Document;
- cache: {
- 'bytes currently in the cache': number;
- 'bytes read into cache': number;
- 'bytes written from cache': number;
- 'checkpoint blocked page eviction': number;
- 'data source pages selected for eviction unable to be evicted': number;
- 'hazard pointer blocked page eviction': number;
- 'in-memory page passed criteria to be split': number;
- 'in-memory page splits': number;
- 'internal pages evicted': number;
- 'internal pages split during eviction': number;
- 'leaf pages split during eviction': number;
- 'modified pages evicted': number;
- 'overflow pages read into cache': number;
- 'overflow values cached in memory': number;
- 'page split during eviction deepened the tree': number;
- 'page written requiring lookaside records': number;
- 'pages read into cache': number;
- 'pages read into cache requiring lookaside entries': number;
- 'pages requested from the cache': number;
- 'pages written from cache': number;
- 'pages written requiring in-memory restoration': number;
- 'tracked dirty bytes in the cache': number;
- 'unmodified pages evicted': number;
- } & Document;
- cache_walk: {
- 'Average difference between current eviction generation when the page was last considered': number;
- 'Average on-disk page image size seen': number;
- 'Clean pages currently in cache': number;
- 'Current eviction generation': number;
- 'Dirty pages currently in cache': number;
- 'Entries in the root page': number;
- 'Internal pages currently in cache': number;
- 'Leaf pages currently in cache': number;
- 'Maximum difference between current eviction generation when the page was last considered': number;
- 'Maximum page size seen': number;
- 'Minimum on-disk page image size seen': number;
- 'On-disk page image sizes smaller than a single allocation unit': number;
- 'Pages created in memory and never written': number;
- 'Pages currently queued for eviction': number;
- 'Pages that could not be queued for eviction': number;
- 'Refs skipped during cache traversal': number;
- 'Size of the root page': number;
- 'Total number of pages currently in cache': number;
- } & Document;
- compression: {
- 'compressed pages read': number;
- 'compressed pages written': number;
- 'page written failed to compress': number;
- 'page written was too small to compress': number;
- 'raw compression call failed, additional data available': number;
- 'raw compression call failed, no additional data available': number;
- 'raw compression call succeeded': number;
- } & Document;
- cursor: {
- 'bulk-loaded cursor-insert calls': number;
- 'create calls': number;
- 'cursor-insert key and value bytes inserted': number;
- 'cursor-remove key bytes removed': number;
- 'cursor-update value bytes updated': number;
- 'insert calls': number;
- 'next calls': number;
- 'prev calls': number;
- 'remove calls': number;
- 'reset calls': number;
- 'restarted searches': number;
- 'search calls': number;
- 'search near calls': number;
- 'truncate calls': number;
- 'update calls': number;
- };
- reconciliation: {
- 'dictionary matches': number;
- 'fast-path pages deleted': number;
- 'internal page key bytes discarded using suffix compression': number;
- 'internal page multi-block writes': number;
- 'internal-page overflow keys': number;
- 'leaf page key bytes discarded using prefix compression': number;
- 'leaf page multi-block writes': number;
- 'leaf-page overflow keys': number;
- 'maximum blocks required for a page': number;
- 'overflow values written': number;
- 'page checksum matches': number;
- 'page reconciliation calls': number;
- 'page reconciliation calls for eviction': number;
- 'pages deleted': number;
- } & Document;
- }
- export declare type WithId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
- _id: InferIdType<TSchema>;
- };
- export declare type WithoutId<TSchema> = Omit<TSchema, '_id'>;
- export declare type WithSessionCallback = (session: ClientSession) => Promise<any>;
- export declare type WithTransactionCallback<T = void> = (session: ClientSession) => Promise<T>;
- export declare class WriteConcern {
-
- readonly w?: W;
-
- readonly journal?: boolean;
-
- readonly wtimeoutMS?: number;
-
- wtimeout?: number;
-
- j?: boolean;
-
- fsync?: boolean | 1;
-
- constructor(w?: W, wtimeoutMS?: number, journal?: boolean, fsync?: boolean | 1);
-
- static apply(command: Document, writeConcern: WriteConcern): Document;
-
- static fromOptions(options?: WriteConcernOptions | WriteConcern | W, inherit?: WriteConcernOptions | WriteConcern): WriteConcern | undefined;
- }
- export declare class WriteConcernError {
-
- constructor(error: WriteConcernErrorData);
-
- get code(): number | undefined;
-
- get errmsg(): string | undefined;
-
- get errInfo(): Document | undefined;
- toJSON(): WriteConcernErrorData;
- toString(): string;
- }
- export declare interface WriteConcernErrorData {
- code: number;
- errmsg: string;
- errInfo?: Document;
- }
- export declare interface WriteConcernOptions {
-
- writeConcern?: WriteConcern | WriteConcernSettings;
- }
- export declare interface WriteConcernSettings {
-
- w?: W;
-
- wtimeoutMS?: number;
-
- journal?: boolean;
-
- j?: boolean;
-
- wtimeout?: number;
-
- fsync?: boolean | 1;
- }
- export declare class WriteError {
- err: BulkWriteOperationError;
- constructor(err: BulkWriteOperationError);
-
- get code(): number;
-
- get index(): number;
-
- get errmsg(): string | undefined;
-
- get errInfo(): Document | undefined;
-
- getOperation(): Document;
- toJSON(): {
- code: number;
- index: number;
- errmsg?: string;
- op: Document;
- };
- toString(): string;
- }
- export { }
|