Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
6.2.1 / 2022-02-07
==================
* perf: improve performance especially of validate and clone #11298 [Uzlopak](https://github.com/Uzlopak)
* perf: remove regexp-clone #11327 [Uzlopak](https://github.com/Uzlopak)
* fix(document): handle initing nested properties in non-strict documents #11309
* fix(query): cast $elemMatch underneath $all #11314
* fix(populate): respect schema-level strictPopulate option #11290
* fix: set default for dotted path projection #11293 [noseworthy](https://github.com/noseworthy)
* fix(model): correctly handle writeConcern.w = 0 when saving #11300
* fix(model): throw VersionError when saving with no changes and optimisticConcurrency = true #11295
* fix(query): avoid adding $each to $addToSet on mixed arrays #11284
* fix(index.d.ts): allow using type: [Schema.Types.ObjectId] for ObjectId arrays #11194
* fix(index.d.ts): make Types.DocumentArray<> convert type to subdoc, rename TMethods -> TMethodsAndOverrides #11061
* fix(index.d.ts): support passing generic to createCollection() and `collection()` for integration with MongoDB Node driver's collection class #11131
* fix(index.d.ts): add strictPopulate to MongooseOptions #11276
* docs: mark Mongoose 6 as compatible with MongoDB 4 #11320 [JavaScriptBach](https://github.com/JavaScriptBach)
* docs: remove documentation for useNestedStrict #11313 [mark-langer](https://github.com/mark-langer)
* docs: add "new" to ObjectId class in aggregate.js docs #11322 [JavanPoirier](https://github.com/JavanPoirier)
* chore: handle eslint configuration in .eslintrc.json #11326 [Uzlopak](https://github.com/Uzlopak)
* refactor: add parenthesis for constructors in tests #11330 [apeltop](https://github.com/apeltop)
6.2.0 / 2022-02-02
==================
* feat(connection+mongoose): add support for continueOnError for syncIndexes #11266 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(query): cast literals in `$expr` where possible #10663
* feat(schema+mongoose): add pluginTags to allow applying global plugins to only schemas with matching tags #9780
* feat(discriminator): support overwriteModels:true to reuse discriminator names #11244 #10931 [IslandRhythms](https://github.com/IslandRhythms)
* feat(index.d.ts): add DocType generic param to Model functions that return queries to better support projections #11156
* feat(error): export MongooseServerSelectionError #11202
* feat(schematype): add validators, path, isRequired to public API and TypeScript types #11139
* fix(model): make exists(...) return lean document with _id or null instead of boolean #11142 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(model): support storing versionKey in nested paths #10980
* fix(index.d.ts): add options to `bulkSave()` type def #11201 [Uzlopak](https://github.com/Uzlopak)
* fix(index.d.ts): better support for query projections #11210 [EugeneKorshenko](https://github.com/EugeneKorshenko)
6.1.10 / 2022-02-01
===================
* fix(mongoose): correctly handle destructured isValidObjectId #11304
* fix(mongoose): defer to MongoDB driver isValid() for `isValidObjectId()` #11227
6.1.9 / 2022-01-31
==================
* fix(query): respect nested schema strict as default when casting query filters #11291
* fix(mongoose): make isValidObjectId() consistent with isValid(), make `ObjectId()` casting more flexible #11209
* fix(setDefaultsOnInsert): ignore defaults underneath maps #11235
* fix(query): avoid setting nested schema properties that are stripped out by strictQuery to undefined in query filter #11291
* fix: check for all flags in a regex deepequal #11242 [Uzlopak](https://github.com/Uzlopak)
* fix: replace substr with substring #11278 [Uzlopak](https://github.com/Uzlopak)
* docs: port for documentation testing in CONTRIBUTING.md #11273 [Uzlopak](https://github.com/Uzlopak)
6.1.8 / 2022-01-24
==================
* fix(connection): stop leaking sessions in .transaction() #11259 #11256 [Uzlopak](https://github.com/Uzlopak)
* perf: remove sliced in favor of Array.prototype.slice() #11238 [Uzlopak](https://github.com/Uzlopak)
* perf: improve setDottedPath #11264 [Uzlopak](https://github.com/Uzlopak)
* fix(document): handle edge case where NestJS sets String.type = String, mixing up schema definitions #11199
* fix: remove obsolete code after upgrading to bson4 #11265 [Uzlopak](https://github.com/Uzlopak)
* fix: remove util.isArray in favor of Array.isArray #11234 [Uzlopak](https://github.com/Uzlopak)
* fix(index.d.ts): avoid UnpackedIntersection making `findOne().populate()` result non-nullable #11041
* docs(migration): add note to change default functions to schema #11245 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: updated docs and issue templates for new FAQs #11171 [IslandRhythms](https://github.com/IslandRhythms)
* chore: fix casting benchmark #11262 [Uzlopak](https://github.com/Uzlopak)
* chore: add mongodb-memory-server to test easier locally #11255 [Uzlopak](https://github.com/Uzlopak)
* chore: fix testing tsconfig #11243 [Uzlopak](https://github.com/Uzlopak)
* refactor: move utils.random to test folder #11239 [Uzlopak](https://github.com/Uzlopak)
6.1.7 / 2022-01-17
==================
* fix(model): correct handling for $push on a nested array #11108
* fix(update): correctly apply timestamps to update pipelines #11151
* fix(document): correctly handle modifying array subdocument after setting array subdocument to itself #11172
* fix(index.d.ts): allow passing options to model() in place of removed `skipInit` #11137
* fix(aggregate): allow passing verbosity to Aggregate.prototype.explain() #11144
* fix(index.d.ts): avoid TypeScript inferring _id as any type with HydratedDocument #11085
* docs: fix Node.js Driver compat link #11214 [wesbos](https://github.com/wesbos)
* docs: remove extraneous backquote #11204 [joebowbeer](https://github.com/joebowbeer)
6.1.6 / 2022-01-10
==================
* perf(document): delay creating document event emitter until used to improve memory usage, several small improvements to improve initing docs with large arrays #10400
* fix(model): avoid `bulkSave()` error when `versionKey: false` #11186 #11071 [IslandRhythms](https://github.com/IslandRhythms)
* fix(model): revert #11079: `findByIdAndUpdate(undefined)` breaking change #11149
* fix(index.d.ts): support strings in deep populate #11181 [ivalduan](https://github.com/ivalduan)
* fix(index.d.ts): rename map() -> transform() to line up with change in v6.0 #11161
* fix(index.d.ts): allow new Model<DocType>(obj) for stricter type checks #11148
* fix(index.d.ts): make Schema.prototype.pre() and post() generics default to HydratedDocument<DocType> #11180
* docs: improve autoCreate docs #11116
* docs(schematype): add missing parameter to example #11185 [kerolloz](https://github.com/kerolloz)
* docs(connections): use updated link to list of MongoDB Node driver `connect()` options #11184 [splinter](https://github.com/splinter)
* docs(aggregate): fix formatting #11191 [enieber](https://github.com/enieber)
* docs: fix broken link #11179 [khairnarsaurabh23](https://github.com/khairnarsaurabh23)
6.1.5 / 2022-01-04
==================
* perf(index.d.ts): simplify Schema typedef for query helpers and methods to significantly reduce TS compiler overhead #10349
* fix(document): allow populating deeply nested models as strings #11168 #11160 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(query): allow calling limit() and skip() with a string #11017
* fix(cursor): propery apply selected fields when loading discriminator docs with query cursor #11130
* fix(mongoose+connection): clone schema correctly when passing instance of another Mongoose instance's Schema to Connection.prototype.model() #11047
* fix(index.d.ts): handle primitives with FlattenMaps #11117
* fix(index.d.ts): enforce id on lean query result type #11118
* fix(index.d.ts): export facet stage type #11150 [mhoc](https://github.com/mhoc)
* fix(index.d.ts): correct return type of projection method #11176 [EugeneKorshenko](https://github.com/EugeneKorshenko)
* fix(index.d.ts): additional fix for `$group` pipeline stage #11140 #11067 [EugeneKorshenko](https://github.com/EugeneKorshenko)
* docs: update CONTRIBUTING.md for TS tests #11164 [ahmedelshenawy25](https://github.com/ahmedelshenawy25)
* docs: use es6 object destructuring instead of regular dot operator for accessing value in object #11147 [Shivaansh-Agarwal](https://github.com/Shivaansh-Agarwal)
6.1.4 / 2021-12-27
==================
* fix(document): handle save with undefined nested doc under subdoc #11110
* fix(document): allow manually populating subdocument refs with `create()` #10856
* fix(populate): handles refPath underneath map of subdocuments #9359
* fix(update): throw error when calling findByIdAndUpdate with undefined id #11079 [gramliu](https://github.com/gramliu)
* fix(mongoose): export ConnectionStates #11133 [orgads](https://github.com/orgads)
* fix(index.d.ts): unpack array when using generic type override with `populate()` #11027
* fix(index.d.ts): fix typings in Merge stage #11132
* fix(index.d.ts): PipelineStage.Merge interface definition is wrong #11109
* docs(typescript): add note about Schema.Types.ObjectId vs Types.ObjectId in document definition #10949
* docs(connection): clarify that "connected" and "open" are different #10886
* docs(populate): correct refPath example to not use on as a schema path name #11113
* docs: fix `strictQuery` example #11135 [MontgomeryWatts](https://github.com/MontgomeryWatts)
5.13.14 / 2021-12-27
====================
* fix(timestamps): avoid setting createdAt on documents that already exist but dont have createdAt #11024
* docs(models): fix up nModified example for 5.x #11055
6.1.3 / 2021-12-21
==================
* perf(populate): avoid duplicate model names when using refPath to avoid O(n^2) memory growth with number of array elements #10983
* fix(schema+model): cast paths marked with ref when hydrating #11052
* fix(schema): handle default function that returns null on document arrays #11058
* fix(document): clean modified paths when setting deeply nested subdocument #11060
* fix(populate): report full path when throwing strictPopulate error with deep populate #10923
* fix(connection): allow calling `setClient()` when disconnected #11114 [hustxiaoc](https://github.com/hustxiaoc)
* fix(index.d.ts): fix typings in Group stage #11124 [DavideViolante](https://github.com/DavideViolante)
* fix(index.d.ts): add Mongoose.prototype.trusted() function to type defs #10957
* fix(index.d.ts): allow use type string in $unset update with aggregation pipeline #11107 [rpenido](https://github.com/rpenido)
* fix(index.d.ts) treat _id like other fields in $project #11102
* docs(migrating_to_6): add omitUndefined to Mongoose 6 migration guide #10672
* docs: add MongooseDocumentArray to API docs #10998
* docs: fix typo in model.js #11121 [eltociear](https://github.com/eltociear)
* docs: fix typo in validation.md #11103 [warlock1996](https://github.com/warlock1996)
6.1.2 / 2021-12-14
==================
* fix: upgrade mongodb driver to 4.2.2 #11092 [lorand-horvath](https://github.com/lorand-horvath)
* fix(model): respect discriminators when calling Model.watch() #11007
* fix(populate): allow referencing parent connection models by name when using `useDb()` #11003
* fix(query): support options param to `Query.prototype.countDocuments()` #11037
* fix(query): correctly use awaitData instead of awaitdata in `Query.prototype.tailable()` #10875
* fix(index.d.ts): fix replaceRoot type #11098 [alibehroozi](https://github.com/alibehroozi)
* fix(index.d.ts): add missing syncIndexes() definition to Mongoose global and Connection class #11065
* fix(index.d.ts): add boolean type for transform option #11057 [AliYusuf95](https://github.com/AliYusuf95)
* docs(model.estimatedDocumentCount): add await into example to get value from the Query #11044 [olecom](https://github.com/olecom)
* docs: fix broken build from awaitdata comment #11096 [medolino](https://github.com/medolino)
* docs: correct Query.prototype.transform() docs #11094 [medolino](https://github.com/medolino)
6.1.1 / 2021-12-09
==================
* fix(document): allow setting nested path to instance of document #11011
* fix(update): respect strict option when casting array filters #11062
* fix(index.d.ts): allow SchemaTypes.Mixed for all schema definition properties to allow using union types #10900
* fix(index.d.ts): correct types for Schema.prototype.obj and `Model.schema` #10895
* docs(migrating_to_6): add note about Types.ObjectId() being a class and requiring `new` #10960
6.1.0 / 2021-12-07
==================
* feat(populate): support ref on subdocuments #10856
* feat(document): add `ownerDocument()` method to top-level document for consistency with subdocs #10884 [IslandRhythms](https://github.com/IslandRhythms)
* fix: upgrade to mongodb driver 4.2.1 #11032 #10985 [lorand-horvath](https://github.com/lorand-horvath) [has-n](https://github.com/has-n)
* feat(schema): support `timeseries` option for MongoDB 5 time series collections support #10611
* feat(mongoose): add global `strictPopulate` option #10694 [IslandRhythms](https://github.com/IslandRhythms)
* feat(mongoose+connection): add global `mongoose.syncIndexes()` and `Connection.prototype.syncIndexes()` #10893 [IslandRhythms](https://github.com/IslandRhythms)
* feat(query): support removing fields from projections #10630 [canac](https://github.com/canac)
* feat(aggregate): add unionWith method to aggregate #10961 [saeidasadi](https://github.com/saeidasadi)
* fix(index.d.ts): types for aggregation pipeline stages #10971 [jeremyben](https://github.com/jeremyben)
6.0.15 / 2021-12-06
===================
* fix(document): avoid overwriting schema methods when creating a new document with `new Model()` and `strict: false` #11001
* fix(document): avoid overwriting top-level document _id with nested `_id` when `strict = false` #10934
* fix(collection): avoid double-calling callback on sync error #10956
* fix(connection): handle direct connection to uninitialized replica set that then becomes initialized #10948
* fix(index.d.ts): allow partial updates on subdocuments for defaults #10947
* fix(index.d.ts): handle buffer type in schema definitions #11026
6.0.14 / 2021-11-29
===================
* fix(document): catch errors in required functions #10968
* fix(connection): clone schema when passing a schema from a different copy of Mongoose to `Connection#model()` #10904
* fix(populate): set empty array [] on virtual populate with no result #10992
* fix(query): handle orFail() with replaceOne() #10963
* fix(populate): use Model by default when using Model.populate() on a POJO #10978
* fix(document): throw VersionError if saving a document with version bump and document isn't found #10974
* fix(index.d.ts): make populate type param optional #10989 [mohd-akram](https://github.com/mohd-akram)
* docs(migrating_to_6): add a note about minimize and toObject() behavior change in v5.10.5 #10827
* docs: remove duplicate `path` in docs #11020 [ItWorksOnMyMachine](https://github.com/ItWorksOnMyMachine)
* docs: fix typo in populate docs #11015 [gavi-shandler](https://github.com/gavi-shandler)
* docs: fix typo in model.js #10982 [eltociear](https://github.com/eltociear)
6.0.13 / 2021-11-15
===================
* fix(document): allows validating doc again if pre validate errors out #10830
* fix: upgrade to mongodb driver 4.1.4 #10955 [mohd-akram](https://github.com/mohd-akram)
* fix(schema): handle functions with accidental type properties in schema definitions #10807
* fix(path): add check to avoid flattening dotted paths on Mongoose docs, improve error when flattening dotted paths causes conflicts #10825
* fix(index.d.ts): rename EnforceDocument -> HydratedDocument, export HydratedDocument for easier typing for users #10843
* fix(index.d.ts): handle maps in TypeScript schema definitions #10838
* fix(index.d.ts): add clone to query #10943 [asportnoy](https://github.com/asportnoy)
* fix(index.d.ts): add strictQuery global option #10933
* fix(index.d.ts): add generic to allow overriding `Schema#clone()` return type #10951 [StefanoA1](https://github.com/StefanoA1)
* docs(typescript): add quick guide to virtuals in TypeScript #10754
* docs(aggregate): remove exec() from AggregationCursor example, no longer correct for Mongoose 6 #10862
* docs(document.js): fix link leading to old github pages site #10958 [PuneetGopinath](https://github.com/PuneetGopinath)
* docs: fixed typo in document.js #10950 [Haosik](https://github.com/Haosik)
5.13.13 / 2021-11-02
====================
* fix: upgrade to mongodb@3.7.3 #10909 [gaurav-sharma-gs](https://github.com/gaurav-sharma-gs)
* fix: correctly emit end event in before close #10916 [iovanom](https://github.com/iovanom)
* fix(index.d.ts): improve ts types for query set #10942 [jneal-afs](https://github.com/jneal-afs)
6.0.12 / 2021-10-21
===================
* fix(cursor): remove the logic for emitting close, rely on autoDestroy option for Node 12 support #10906 [iovanom](https://github.com/iovanom)
* fix(map): support passing flattenMaps: false to Map toJSON(), make `toJSON()` flatten maps by default in TypeScript #10872
* fix: upgrade to mongodb driver 4.1.3 #10911 [orgads](https://github.com/orgads)
* fix(index.d.ts): correct TS function signature for `SchemaType.prototype.set()` #10799
* fix(index.d.ts): support implicit $in in FilterQuery #10826
* fix(index.d.ts): More precise type for Schema.clone() #10899 [coyotte508](https://github.com/coyotte508)
* fix(index.d.ts): add caster property to schema arrays and document arrays #10865
* docs: update `updateMany()` and `deleteMany()` docs to reflect new `matchedCount`, `modifiedCount`, `deletedCount` properties #10908 [IslandRhythms](https://github.com/IslandRhythms)
* docs: fix broken links to populate virtuals #10870 [IslandRhythms](https://github.com/IslandRhythms)
* docs: updated docs to have returnOriginal, removed new and returnDocument #10887 [IslandRhythms](https://github.com/IslandRhythms)
5.13.12 / 2021-10-19
====================
* fix(cursor): use stream destroy method on close to prevent emitting duplicate 'close' #10897 [iovanom](https://github.com/iovanom)
* fix(index.d.ts): backport streamlining of FilterQuery and DocumentDefinition to avoid "excessively deep and possibly infinite" TS errors #10617
6.0.11 / 2021-10-14
===================
* perf(index.d.ts): remove some unnecessary definitions, streamline some union types to reduce number of instantiations #10349
* fix(cursor): use stream destroy method on close to prevent emitting duplicate 'close' #10878 #10876 [iovanom](https://github.com/iovanom)
* fix: create indexes when readPreference=primary is set #10861 #10855 [gemyero](https://github.com/gemyero)
* fix(document): avoid depopulating when setting array of subdocs from different doc #10819
* fix(index.d.ts): allow modifying properties of UpdateQuery instances #10786
* fix(index.d.ts): add generic Paths to populate() to allow overriding path types #10758
5.13.11 / 2021-10-12
====================
* fix: upgrade mongodb -> 3.7.2 #10871 [winstonralph](https://github.com/winstonralph)
* fix(connection): call setMaxListeners(0) on MongoClient to avoid event emitter memory leak warnings with `useDb()` #10732
6.0.10 / 2021-10-08
===================
* fix(query): add back strictQuery option to avoid empty filter issues, tie it to `strict` by default for compatibility #10781 #10763
* fix(model): avoid unnecessarily dropping text indexes in `syncIndexes()` #10851 #10850 [IslandRhythms](https://github.com/IslandRhythms)
* fix(query): avoid trying to call toArray() on cursor if find() error occurred #10845
* fix: accepts uppercase values in mongoose.isValidObjectId #10846 [foxadb](https://github.com/foxadb)
* perf(document): further reduce unnecessary objects and keys to minimize document memory overhead #10400
* fix(index.d.ts): restore unpacked type and avoid distributive conditional types #10859 [dbellavista](https://github.com/dbellavista)
* fix(index.d.ts): add correct null typings for `findOneAndUpdate()` and `findByIdAndUpdate()` #10820
* fix(index.d.ts): make insertMany() correctly return Promise<Array> if passing single document to `insertMany()` #10802
* fix(index.d.ts): avoid weird issue where TypeScript 4.3.x and 4.4.x makes string extend Function #10746
* fix(index.d.ts): allow type: `SchemaTypeOptions[]` when defining schema #10789
* fix(index.d.ts): allow using `$in` with enum fields #10757 #10734
* fix(index.d.ts): add missing fields and options params to Model constructor #10817
* fix(index.d.ts): support extending type for mongoose.models #10806 [MunifTanjim](https://github.com/MunifTanjim)
* docs: enhance docs section linking #10779 [saveman71](https://github.com/saveman71)
* docs(middleware): add missing query middleware #10721
* docs: fix typo #10853 [mdatif796](https://github.com/mdatif796)
* docs: add missing to #10848 [digidub](https://github.com/digidub)
5.13.10 / 2021-10-05
====================
* fix(index.d.ts): allow using type: SchemaDefinitionProperty in schema definitions #10674
* fix(index.d.ts): allow AnyObject as param to findOneAndReplace() #10714
6.0.9 / 2021-10-04
==================
* fix(document): init non-schema values if strict is set to false #10828
* fix(document): correctly track saved state for deeply nested objects #10773
* fix(array): avoid mutating arrays passed into Model() constructor #10766
* fix(cursor): allow using find().cursor() before connecting, report errors in pre('find') hooks when using `.cursor()` #10785
* fix(populate): support ref: Model with virtual populate #10695
* fix(schema): support type: { subpath: String } in document array definitions and improve schema `interpretAsType` error messages if type name is undefined #10750
* fix: upgrade to mongodb driver 4.1.2 #10810 [orgads](https://github.com/orgads)
* fix(subdocument): add extra precaution to throw an error if a subdocument is a parent of itself in `ownerDocument()` #9259
* perf(index.d.ts): make `model()` call more strict to improve VS Code autocomplete perf #10801 [traverse1984](https://github.com/traverse1984)
* fix(index.d.ts): allow calling depopulate with 0 args #10793
* fix(index.d.ts): Add type definitions for allowDiskUse #10791 [coyotte508](https://github.com/coyotte508)
* docs(populate): expand virtual populate docs with info on principle of least cardinality and other info #10558
* docs: add migration guide to side bar #10769
* docs(connections+api): clarify that maxPoolSize is now 100 by default #10809
* docs(schema): add Schema#virtuals to docs as a public property #10829
* docs: remove array indexes section from FAQ #10784 [Duchynko](https://github.com/Duchynko)
* docs(model): fix broken example #10831 [Okekeprince1](https://github.com/Okekeprince1)
* docs: fix markdown issue with schemas.md #10839 [aseerkt](https://github.com/aseerkt)
6.0.8 / 2021-09-27
==================
* fix: support $set on elements of map of subdocuments #10720
* fix(schematype): handle schema type definition where unique: false and `index` not set #10738
* fix(timestamps): handle `createdAt` with custom `typeKey` #10768 #10761 [jclaudan](https://github.com/jclaudan)
* fix(model): amend Model.translateAliases to observe non-aliased sub schemas #10772 [frisbee09](https://github.com/frisbee09)
* fix: allow ObjectId#valueOf() to override built-in `Object#valueOf()`, clarify using `==` with ObjectIds in migration guide #10741
* fix: use process.emitWarning() instead of console.warn() for warnings #10687
* fix(index.d.ts): allow array of schema type options for string[], `number[]` property Schema definitions #10731
* fix(index.d.ts): make built-in subdocument properties not required in UpdateQuery #10597
* docs(ssl): correct sslCA option and clarify that sslCA should be the path to the CA file #10705
6.0.7 / 2021-09-20
==================
* fix(populate): wrap populate filters in trusted() so they work with `sanitizeFilter` #10740
* fix(aggregate): handle calling aggregate() before initial connection succeeds #10722
* fix(query): avoid throwing error when using `$not` with `$size` #10716 [IslandRhythms](https://github.com/IslandRhythms)
* fix(discriminator): handle setting nested discriminator paths #10702
* fix(documentarray): don't throw TypeError on DocumentArray#create() when top-level doc has populated paths #10749
* fix(update): avoid setting single nested subdoc defaults if subdoc isn't set #10660
* fix: delay creating id virtual until right before model compilation to allow plugins to disable the `id` option #10701
* fix(connection): correct `auth` object when using `user` option to `connect()` #10727 #10726 [saveman71](https://github.com/saveman71)
* fix(timestamps): avoid calling getters when checking whether `createdAt` is set #10742 [kaishu16](https://github.com/kaishu16)
* fix(index.d.ts): allow using strings for ObjectIds with $in #10735
* fix(index.d.ts): add TVirtuals generic to Model to make it easier to separate virtuals from DocType #10689
* fix(index.d.ts): add Model.bulkSave() definition #10745
* fix(index.d.ts): allow RegExp for `match` in schema definition #10744 [easen-amp](https://github.com/easen-amp)
* fix(index.d.ts): allow arbitrary additional keys in QueryOptions #10688
* docs: correct TypeScript schema generic params in docs #10739 [minifjurt123](https://github.com/minifjurt123)
* docs: fix h2 header links #10682 [IslandRhythms](https://github.com/IslandRhythms)
6.0.6 / 2021-09-15
==================
* perf(index.d.ts): streamline SchemaDefinitionType and SchemaTypeOptions to reduce number of instantiations and speed up lib checking #10349
* perf(document): make $locals a getter/setter, avoid creating unnecessary `undefined` properties in Document constructor, remove unnecessary event listeners #10400
* fix(connection): use username parameter for MongoDB driver instead of user #10727 [saveman71](https://github.com/saveman71)
* fix(update): handle casting $or and $and in array filters #10696
* fix(connection): allow calling connection helpers before calling `mongoose.connect()` #10706
* fix(document): correctly handle subpaths of arrays that contain non-alphanumeric chars like `-` #10709
* fix(index.d.ts): correct return value for findOneAndUpdate(), `findByIdAndUpdate()` to support query helpers #10658
* fix(index.d.ts): add missing methods to ValidationError & ValidatorError classes #10725 [medfreeman](https://github.com/medfreeman)
* perf(subdocument): make internal $isSingleNested and `$isDocumentArrayElement` properties constants on the prototype rather than setting them on every instance #10400
* docs: improve Document#populate documentation, tests #10728 [saveman71](https://github.com/saveman71)
6.0.5 / 2021-09-06
==================
* fix(model): allow calling Model.validate() static with POJO array #10669
* fix(cast): let $expr through in query filters if strict mode enabled #10662
* fix(map): propagate flattenMaps option down to nested maps #10653
* fix(setDefaultsOnInsert): avoid adding unnecessary auto _id to $setOnInsert #10646
* fix(schema): support object with values and message syntax for Number enums #10648
* fix(index.d.ts): fix Document#populate() type #10651 [thiagokisaki](https://github.com/thiagokisaki)
* fix(index.d.ts): allow using $in and $nin on array paths #10605
* fix(index.d.ts): make _id required in query results and return value from `create()` #10657
* docs: update deprecations.md to reflect version 6 #10673 [multiwebinc](https://github.com/multiwebinc)
* docs: fix typo in queries.md #10681 [yogabonito](https://github.com/yogabonito)
* docs: fix typo in models.md #10680 [yogabonito](https://github.com/yogabonito)
* ci: add test for ubuntu-20.04 #10679 [YC](https://github.com/YC)
5.13.9 / 2021-09-06
===================
* fix(populate): avoid setting empty array on lean document when populate result is undefined #10599
* fix(document): make depopulate() handle populated paths underneath document arrays #10592
* fix: peg @types/bson version to 1.x || 4.0.x to avoid stubbed 4.2.x release #10678
* fix(index.d.ts): simplify UpdateQuery to avoid "excessively deep and possibly infinite" errors with `extends Document` and `any` #10647
* fix(index.d.ts): allow specifying weights as an IndexOption #10586
* fix: upgrade to mpath v0.8.4 re: security issue #10683
6.0.4 / 2021-09-01
==================
* fix(schema): handle maps of maps #10644
* fix: avoid setting defaults on insert on a path whose subpath is referenced in the update #10624
* fix(index.d.ts): simplify UpdateQuery to avoid "excessively deep and possibly infinite" errors with `extends Document` and `any` #10617
* fix(index.d.ts): allow using type: [documentDefinition] when defining a doc array in a schema #10605
* docs: remove useNewUrlParser, useUnifiedTopology, some other legacy options from docs #10631 #10632
* docs(defaults): clarify that setDefaultsOnInsert is true by default in 6.x #10643
* test: use async/await instead of co #10633 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
6.0.3 / 2021-08-30
==================
* fix: handle buffering with find() now that find() no longer accepts a callback #10639 #10634 #10610
6.0.2 / 2021-08-26
==================
* fix(query): handle find() when buffering on initial connection #10610
* fix(populate): get doc schema using $__schema to avoid paths named `schema` #10619
* docs: use async/await in the quickstart #10610
* docs: fix links to guide, schematypes, connections in v5.x docs #10607
* docs: add link to 6.x migration guide to schemas guide #10616
* docs: add migration to 6.x in Migration Guides section #10618 [HunterKohler](https://github.com/HunterKohler)
* docs: fix missing URL part on layout.pug #10622 [ItsLhun](https://github.com/ItsLhun)
6.0.1 / 2021-08-25
==================
* fix(aggregate): allow calling Model.aggregate() with options #10604 [amitbeck](https://github.com/amitbeck)
* fix(index.d.ts): add instance, options, schema properties to SchemaType class #10609
* fix(index.d.ts): allow querying array of strings by string #10605
* fix(index.d.ts): allow using type: SchemaDefinitionProperty in schema definitions #10605
* fix(index.d.ts): remove strictQuery option #10598 [thiagokisaki](https://github.com/thiagokisaki)
* docs: add link to migration guide in changelog #10600 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: fix docs build for v5.x docs #10607
* docs(query): add note about strict option to setOptions() #10602
6.0.0 / 2021-08-24
==================
* Follow the [migration guide](https://mongoosejs.com/docs/migrating_to_6.html) to get a list of all breaking changes in v6.0.
* BREAKING CHANGE: remove the deprecated safe option in favor of write concerns
* fix: upgrade to mongodb driver 4.1.1
* fix: consistently use $__parent to store subdoc parent as a property, and `$parent()` as a getter function #10584 #10414
* fix: allow calling `countDocuments()` with options
6.0.0-rc2 / 2021-08-23
======================
* BREAKING CHANGE: make document set() set keys in the order they're defined in the schema, not in the user specified object #4665
* BREAKING CHANGE: remove most schema reserved words - can now opt in to using `save`, `isNew`, etc. as schema paths #9010 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* BREAKING CHANGE: upgrade mquery -> 4.x #10579
* BREAKING CHANGE: remove some legacy type aliases for TypeScript
* fix(document): pass depopulated value to array element validators for consistency #10585 #8042
5.13.8 / 2021-08-23
===================
* fix(populate): handle populating subdoc array virtual with sort #10552
* fix(model): check for code instead of codeName when checking for existing collections for backwards compat with MongoDB 3.2 #10420
* fix(index.d.ts): correct value of this for custom query helper methods #10545
* fix(index.d.ts): allow strings for ObjectIds in nested properties #10573
* fix(index.d.ts): add match to VirtualTypeOptions.options #8749
* fix(index.d.ts): allow QueryOptions populate parameter type PopulateOptions #10587 [osmanakol](https://github.com/osmanakol)
* docs(api): add Document#$where to API docs #10583
6.0.0-rc1 / 2021-08-12
======================
* feat: upgrade to MongoDB driver 4.1.0 #10567 #10560
* feat: add `valueOf()` to ObjectId prototype #7299
* BREAKING CHANGE: rename History.md -> CHANGELOG.md #10542
5.13.7 / 2021-08-11
===================
* perf(index.d.ts): loosen up restrictions on ModelType generic for Schema for a ~50% perf improvement when compiling TypeScript and using intellisense #10536 #10515 #10349
* fix(index.d.ts): fix broken `Schema#index()` types #10562 [JaredReisinger](https://github.com/JaredReisinger)
* fix(index.d.ts): allow using SchemaTypeOptions with array of raw document interfaces #10537
* fix(index.d.ts): define IndexOptions in terms of mongodb.IndexOptions #10563 [JaredReisinger](https://github.com/JaredReisinger)
* fix(index.d.ts): improve intellisense for DocumentArray `push()` #10546
* fix(index.d.ts): correct type for expires #10529
* fix(index.d.ts): add Query#model property to ts bindings #10531
* refactor(index.d.ts): make callbacks use the new Callback and CallbackWithoutResult types #10550 [thiagokisaki](https://github.com/thiagokisaki)
5.13.6 / 2021-08-09
===================
* fix: upgrade mongodb driver -> 3.6.11 #10543 [maon-fp](https://github.com/maon-fp)
* fix(schema): throw more helpful error when defining a document array using a schema from a different copy of the Mongoose module #10453
* fix: add explicit check on constructor property to avoid throwing an error when checking objects with null prototypes #10512
* fix(cursor): make sure to clear stack every 1000 docs when calling `next()` to avoid stack overflow with large batch size #10449
* fix(index.d.ts): allow calling new Model(...) with generic Model param #10526
* fix(index.d.ts): update type declarations of Schema.index method #10538 #10530 [Raader](https://github.com/Raader)
* fix(index.d.ts): add useNewUrlParser and useUnifiedTopology to ConnectOptions #10500
* fix(index.d.ts): add missing type for diffIndexes #10547 [bvgusak](https://github.com/bvgusak)
* fix(index.d.ts): fixed incorrect type definition for Query's .map function #10544 [GCastilho](https://github.com/GCastilho)
* docs(schema): add more info and examples to Schema#indexes() docs #10446
* chore: add types property to package.json #10557 [thiagokisaki](https://github.com/thiagokisaki)
6.0.0-rc0 / 2021-08-03
======================
* BREAKING CHANGE: upgrade to MongoDB Node.js driver 4.x. This adds support for MongoDB 5.0, drops support for Node.js < 12.0.0 #10338 #9840 #8759
* BREAKING CHANGE(connection): make connections not thenable, add `Connection#asPromise()` to use a connection as a promise #8810
* BREAKING CHANGE: throw an error if the same query object is executed multiple times #7398
* BREAKING CHANGE: Mongoose arrays are now proxies, which means directly setting an array index `doc.arr[0] = 'test'` triggers change tracking #8884
* BREAKING CHANGE: make Document#populate() return a promise if a callback isn't passed, remove `execPopulate()` #3834
* BREAKING CHANGE: virtual getters and setters are now executed in forward order, rather than reverse order. This means you can add getters/setters to populated virtuals #8897 [ggurkal](https://github.com/ggurkal)
* BREAKING CHANGE: make setDefaultsOnInsert true by default. Set to `false` to disable it. #8410
* BREAKING CHANGE: throw error by default if populating a path that isn't in the schema #5124
* BREAKING CHANGE: make schema paths declared with `type: { name: String }` create a single nested subdoc, remove `typePojoToMixed` because it is now always false #7181
* BREAKING CHANGE: remove context option for queries, always use `context: 'query'` #8395
* BREAKING CHANGE: array subdocument class now inherits from single subdocument class #8554
* BREAKING CHANGE: if model is registered on a non-default connection, don't register it on mongoose global #5758
* BREAKING CHANGE: `Aggregate#cursor()` now returns aggregation cursor, rather than aggregate instance #10410 [IslandRhythms](https://github.com/IslandRhythms)
* BREAKING CHANGE: `useStrictQuery` is removed, `strict` applies for both #9015
* BREAKING CHANGE: overwrite instead of merging when setting nested paths #9121
* BREAKING CHANGE: call ref and refPath functions with subdoc being populated, not top-level doc #8469
* BREAKING CHANGE: remove useFindAndModify option, always use MongoDB's native `findOneAndReplace()` rather than legacy `findAndModify()` #8737
* BREAKING CHANGE: always pass unpopulated value to validators #8042 [IslandRhythms](https://github.com/IslandRhythms)
* BREAKING CHANGE: rename Embedded/SingleNestedPath -> Subdocument/SubdocumentPath #10419
* BREAKING CHANGE: call setters with priorVal as 2nd parameter, and with new subdocument as context if creating new document #8629
* BREAKING CHANGE: pass document as first parameter to `default` functions #9633 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* BREAKING CHANGE: make filter, flat, flatMap, map, and slice return vanilla JS arrays #8356
* BREAKING CHANGE: make autoCreate true by default #8814
* BREAKING CHANGE: clone schema passed to discriminator() #8552
* BREAKING CHANGE: make autoIndex and autoCreate default to false if connection's read preference is 'secondary' or 'secondaryPreferred' #9374 [chumager](https://github.com/chumager)
* BREAKING CHANGE: make deepEqual treat objects with different order of keys as different #9571 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* BREAKING CHANGE: Make Model.exists() return a query rather than a promise, and resolve to doc or null, rather than true/false #8097
* BREAKING CHANGE: `Model.create([])` now returns an empty array rather than undefined #8792 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* BREAKING CHANGE: `createdAt` schema path is now `immutable` by default #10139 [IslandRhythms](https://github.com/IslandRhythms)
* BREAKING CHANGE: dont start buffering when database is disconnected #8702
* BREAKING CHANGE: emit 'disconnected' when losing connectivity to replica set primary #9262
* BREAKING CHANGE: Make Aggregate#model() always return a model rather than an aggregate instance #7702
* BREAKING CHANGE: remove omitUndefined option for updates - Mongoose now always removes `undefined` keys in updates #7680
* BREAKING CHANGE: remove Aggregate#addCursorFlag(), use `Aggregate#options()` instead #8701
* BREAKING CHANGE: rename Query#map() -> Query#transform() to avoid conflating with Array#map() and chaining #7951
* BREAKING CHANGE: remove storeSubdocumentValidationError schema option, never store subdocument ValidationErrors #5226
* BREAKING CHANGE(query): make find() with explain() return object instead of an array #8551
* BREAKING CHANGE: allow undefined in number arrays unlles `required` #8738
* BREAKING CHANGE: remove isAsync option for validators in favor of checking if a function is an async function #10502
* BREAKING CHANGE: drop support for Model#model #8958 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* BREAKING CHANGE: remove useNestedStrict, use nested schema strict mode when casting updates unless `strict` is explicitly specified in query options #8961
* BREAKING CHANGE: remove `safe-buffer`, make MongooseBuffer extend from native Buffer #9199 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* BREAKING CHANGE(schema): skip adding id virtual if schema doesn't have an `_id` path #3936
* BREAKING CHANGE: remove skipInit parameter to mongoose.model() #4625
* BREAKING CHANGE: make pluralize convert "goose" to "geese" #9278
* BREAKING CHANGE: the `Schema#noId` option is now removed, please use `_id` instead #9398
* BREAKING CHANGE: remove MONGOOSE_DRIVER_PATH, use a setDriver() function on Mongoose instance instead #9604
* feat(mongoose+query): add `sanitizeFilter` option and `mongoose.trusted()` to defend against query selector injection attacks #3944
* feat(query): add Query#clone() so you can more easily re-execute a query #8708
* feat(virtual+populate): allow `foreignField` to be a function #8568 [BJvdA](https://github.com/BJvdA)
5.13.5 / 2021-07-30
===================
* perf(index.d.ts): improve typescript type checking performance #10515 [andreialecu](https://github.com/andreialecu)
* fix(index.d.ts): fix debug type in MongooseOptions #10510 [thiagokisaki](https://github.com/thiagokisaki)
* docs(api): clarify that `depopulate()` with no args depopulates all #10501 [gfrancz](https://github.com/gfrancz)
5.13.4 / 2021-07-28
===================
* fix: avoid pulling non-schema paths from documents into nested paths #10449
* fix(update): support overwriting nested map paths #10485
* fix(update): apply timestamps to subdocs that would be newly created by `$setOnInsert` #10460
* fix(map): correctly clone subdocs when calling toObject() on a map #10486
* fix(cursor): cap parallel batchSize for populate at 5000 #10449
* fix(index.d.ts): improve autocomplete for new Model() by making `doc` an object with correct keys #10475
* fix(index.d.ts): add MongooseOptions interface #10471 [thiagokisaki](https://github.com/thiagokisaki)
* fix(index.d.ts): make LeanDocument work with PopulatedDoc #10494
* docs(mongoose+connection): correct default value for bufferTimeoutMS #10476
* chore: remove unnecessary 'eslint-disable' comments #10466 [thiagokisaki](https://github.com/thiagokisaki)
5.13.3 / 2021-07-16
===================
* fix(model): avoid throwing error when bulkSave() called on a document with no changes #10437
* fix(timestamps): apply timestamps when creating new subdocs with `$addToSet` and with positional operator #10447
* fix(schema): allow calling Schema#loadClass() with class that has a static getter with no setter #10436
* fix(model): handle re-applying object defaults after explicitly unsetting #10442 [semirturgay](https://github.com/semirturgay)
* fix: bump mongodb driver -> 3.6.10 #10440 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(index.d.ts): consistently use NativeDate instead of Date for Date validators and timestamps functions #10426
* fix(index.d.ts): allow calling `discriminator()` with non-document #10452 #10421 [DouglasGabr](https://github.com/DouglasGabr)
* fix(index.d.ts): allow passing ResultType generic to Schema#path() #10435
5.13.2 / 2021-07-03
===================
* fix: hardcode @types/node version for now to avoid breaking changes from DefinitelyTyped/DefinitelyTyped#53669 #10415
* fix(index.d.ts): allow using type: Date with Date paths in SchemaDefinitionType #10409
* fix(index.d.ts): allow extra VirtualTypeOptions for better plugin support #10412
* docs(api): add SchemaArray to docs #10397
* docs(schema+validation): fix broken links #10396
* docs(transactions): add note about creating a connection to transactions docs #10406
5.13.1 / 2021-07-02
===================
* fix(discriminator): allow using array as discriminator key in schema and as tied value #10303
* fix(index.d.ts): allow using & Document in schema definition for required subdocument arrays #10370
* fix(index.d.ts): if using DocType that doesn't extends Document, default to returning that DocType from `toObject()` and `toJSON()` #10345
* fix(index.d.ts): use raw DocType instead of LeanDocument when using `lean()` with queries if raw DocType doesn't `extends Document` #10345
* fix(index.d.ts): remove err: any in callbacks, use `err: CallbackError` instead #10340
* fix(index.d.ts): allow defining map of schemas in TypeScript #10389
* fix(index.d.ts): correct return type for Model.createCollection() #10359
* docs(promises+discriminators): correctly escape () in regexp to pull in examples correctly #10364
* docs(update): fix outdated URL about unindexed upsert #10406 [grimmer0125](https://github.com/grimmer0125)
* docs(index.d.ts): proper placement of mongoose.Date JSDoc [thiagokisaki](https://github.com/thiagokisaki)
5.13.0 / 2021-06-28
===================
* feat(query): add sanitizeProjection option to opt in to automatically sanitizing untrusted query projections #10243
* feat(model): add `bulkSave()` function that saves multiple docs in 1 `bulkWrite()` #9727 #9673 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(document): allow passing a list of virtuals or `pathsToSkip` to apply in `toObject()` and `toJSON()` #10120
* fix(model): make Model.validate use object under validation as context by default #10360 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(document): add support for pathsToSkip in validate and validateSync #10375 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(model): add `diffIndexes()` function that calculates what indexes `syncIndexes()` will create/drop without actually executing any changes #10362 [IslandRhythms](https://github.com/IslandRhythms)
* feat(document): avoid using sessions that have ended, so you can use documents that were loaded in the session after calling `endSession()` #10306
5.12.15 / 2021-06-25
====================
* fix(index.d.ts): add extra TInstanceMethods generic param to `Schema` for cases when we can't infer from Model #10358
* fix(index.d.ts): added typings for near() in model aggregation #10373 [tbhaxor](https://github.com/tbhaxor)
* fix(index.d.ts): correct function signature for `Query#cast()` #10388 [lkho](https://github.com/lkho)
* docs(transactions): add import statement #10365 [JimLynchCodes](https://github.com/JimLynchCodes)
* docs(schema): add missing `discriminatorKey` schema option #10386 #10376 [IslandRhythms](https://github.com/IslandRhythms)
* docs(index.d.ts): fix typo #10363 [houssemchebeb](https://github.com/houssemchebeb)
5.12.14 / 2021-06-15
====================
* fix(schema): check that schema type is an object when setting isUnderneathDocArray #10361 [vmo-khanus](https://github.com/vmo-khanus)
* fix(document): avoid infinite recursion when setting single nested subdoc to array #10351
* fix(populate): allow populating nested path in schema using `Model.populate()` #10335
* fix(drivers): emit operation-start/operation-end events to allow inspecting when operations start and end
* fix(index.d.ts): improve typings for virtuals #10350 [thiagokisaki](https://github.com/thiagokisaki)
* fix(index.d.ts): correct constructor type for Document #10328
* fix(index.d.ts): add `ValidationError` as a possible type for `ValidationError#errors` #10320 [IslandRhythms](https://github.com/IslandRhythms)
* fix: remove unnecessary async devDependency that's causing npm audit warnings #10281
* docs(typescript): add schemas guide #10308
* docs(model): add options parameter description to `Model.exists()` #10336 [Aminoiz](https://github.com/Aminoiz)
5.12.13 / 2021-06-04
====================
* perf(document): avoid creating nested paths when running `$getAllSubdocs()` #10275
* fix: make returnDocument option work with `findOneAndUpdate()` #10232 #10231 [cnwangjie](https://github.com/cnwangjie)
* fix(document): correctly reset subdocument when resetting a map subdocument underneath a single nested subdoc after save #10295
* perf(query): avoid setting non-null sessions to avoid overhead from $getAllSubdocs() #10275
* perf(document): pre split schematype paths when compiling schema to avoid extra overhead of splitting when hydrating documents #10275
* perf(schema): pre-calculate mapPaths to avoid looping over every path for each path when initing doc #10275
* fix(index.d.ts): drill down into nested arrays when creating LeanDocument type #10293
5.12.12 / 2021-05-28
====================
* fix(documentarray): retain atomics when setting to a new array #10272
* fix(query+model): fix deprecation warning for `returnOriginal` with `findOneAndUpdate()` #10298 #10297 #10292 #10285 [IslandRhythms](https://github.com/IslandRhythms)
* fix(index.d.ts): make `map()` result an array if used over an array #10288 [quantumsheep](https://github.com/quantumsheep)
5.12.11 / 2021-05-24
====================
* fix(populate): skip applying setters when casting arrays for populate() to avoid issues with arrays of immutable elements #10264
* perf(schematype): avoid cloning setters every time we run setters #9588
* perf(get): add benchmarks and extra cases to speed up get() #9588
* perf(array): improve array constructor performance on small arrays to improve nested array perf #9588
* fix(index.d.ts): allow using type: [String] with string[] when using SchemaDefinition with generic #10261
* fix(index.d.ts): support ReadonlyArray as well as regular array where possible in schema definitions #10260
* docs(connection): document noListener option to useDb #10278 [stuartpb](https://github.com/stuartpb)
* docs: migrate raw tutorial content from pug / JS to markdown #10271
* docs: fix typo #10269 [sanjib](https://github.com/sanjib)
5.12.10 / 2021-05-18
====================
* fix(query): allow setting `defaults` option on result documents from query options #7287 [IslandRhythms](https://github.com/IslandRhythms)
* fix(populate): handle populating embedded discriminator with custom tiedValue #10231
* fix(document): allow passing space-delimited string of `pathsToValidate` to `validate()` and `validateSync()` #10258
* fix(model+schema): support `loadClass()` on classes that have `collection` as a static property #10257 #10254 [IslandRhythms](https://github.com/IslandRhythms)
* fix(SchemaArrayOptions): correct property name #10236
* fix(index.d.ts): add any to all query operators to minimize likelihood of "type instantiation is excessively deep" when querying docs with 4-level deep subdocs #10189
* fix(index.d.ts): add $parent() in addition to parent() in TS definitions
* fix(index.d.ts): correct async iterator return type for QueryCursor #10253 #10252 #10251 [borfig](https://github.com/borfig)
* fix(index.d.ts): add `virtualsOnly` parameter to `loadClass()` function signature [IslandRhythms](https://github.com/IslandRhythms)
* docs(typescript): add typescript populate docs #10212
* docs: switch from AWS to Azure Functions for search #10244
5.12.9 / 2021-05-13
===================
* fix(schema): ensure add() overwrites existing schema paths by default #10208 #10203
* fix(schema): support creating nested paths underneath document arrays #10193
* fix(update): convert nested dotted paths in update to nested paths to avoid ending up with dotted properties in update #10200
* fix(document): allow calling validate() and validateSync() with `options` as first parameter #10216
* fix(schema): apply static properties to model when using loadClass() #10206
* fix(index.d.ts): allow returning Promise<void> from middleware functions #10229
* fix(index.d.ts): add pre('distinct') hooks to TypeScript #10192
5.12.8 / 2021-05-10
===================
* fix(populate): handle populating immutable array paths #10159
* fix(CastError): add `toJSON()` function to ensure `name` property always ends up in `JSON.stringify()` output #10166 [IslandRhythms](https://github.com/IslandRhythms)
* fix(query): add allowDiskUse() method to improve setting MongoDB 4.4's new `allowDiskUse` option #10177
* fix(populate): allow populating paths under mixed schematypes where some documents have non-object properties #10191
* chore: remove unnecessary driver dynamic imports so Mongoose can work with Parcel #9603
* fix(index.d.ts): allow any object as parameter to create() and `insertMany()` #10144
* fix(index.d.ts): allow creating Model class with raw interface, no `extends Document` #10144
* fix(index.d.ts): separate UpdateQuery from `UpdateWithAggregationPipeline` for cases when `UpdateQuery` is used as a function param #10186
* fix(index.d.ts): don't require error value in pre/post hooks #10213 [michaln-q](https://github.com/michaln-q)
* docs(typescript): add a typescript intro tutorial and statics tutorial #10021
* docs(typescript): add query helpers tutorial #10021
* docs(deprecations): add note that you can safely ignore `useFindAndModify` and `useCreateIndex` deprecation warnings #10155
* chore(workflows): add node 16 to github actions #10201 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.12.7 / 2021-04-29
===================
* fix(document): make $getPopulatedDocs() return populated virtuals #10148
* fix(discriminator): take discriminator schema's single nested paths over base schema's #10157
* fix(discriminator): allow numbers and ObjectIds as tied values for discriminators #10130
* fix(document): avoid double validating paths underneath mixed objects in save() #10141
* fix(schema): allow path() to return single nested paths within document arrays #10164
* fix(model+query): consistently wrap query callbacks in `process.nextTick()` to avoid clean stack traces causing memory leak when using synchronous recursion like `async.whilst()` #9864
* fix(cursor): correctly report CastError when using noCursorTimeout flag #10150
* fix(index.d.ts): add CastError constructor #10176
* fix(index.d.ts): allow setting mongoose.pluralize(null) in TypeScript #10185
* docs: add link to transactions guide from nav bar #10143
* docs(validation): add section about custom error messages #10140
* docs: make headers linkable via clicking #10156
* docs: broken link in document.js #10190 [joostdecock](https://github.com/joostdecock)
* docs: make navbar responsive on legacy 2.x docs #10171 [ad99526](https://github.com/ad99526)
5.12.6 / 2021-04-27
===================
* fix(query): allow setting `writeConcern` schema option to work around MongoDB driver's `writeConcern` deprecation warning #10083 #10009 [IslandRhythms](https://github.com/IslandRhythms)
* fix(populate): dedupe when virtual populate foreignField is an array to avoid duplicate docs in result #10117
* fix(populate): add `localField` filter to `$elemMatch` on virtual populate when custom `match` has a `$elemMatch` and `foreignField` is an array #10117
* fix(query): convert projection string values to numbers as a workaround for #10142
* fix(document): set version key filter on `save()` when using `optimisticConcurrency` if no changes in document #10128 [IslandRhythms](https://github.com/IslandRhythms)
* fix(model): use `obj` as `context` in `Model.validate()` if `obj` is a document #10132
* fix(connection): avoid db events deprecation warning when using `useDb()` with `useUnifiedTopology` #8267
* fix: upgrade to sift@13.5.2 to work around transitive dev dependency security warning #10121
* fix(index.d.ts): allow any object as parameter to `create()` and `insertMany()` #10144
* fix(index.d.ts): clarify that `eachAsync()` callback receives a single doc rather than array of docs unless `batchSize` is set #10135
* fix(index.d.ts): clarify that return value from `validateSync()` is a ValidationError #10147 [michaln-q](https://github.com/michaln-q)
* fix(index.d.ts): add generic type for Model constructor #10074 [Duchynko](https://github.com/Duchynko)
* fix(index.d.ts): add parameter type in merge #10168 [yoonhoGo](https://github.com/yoonhoGo)
5.12.5 / 2021-04-19
===================
* fix(populate): handle populating underneath document array when document array property doesn't exist in db #10003
* fix(populate): clear out dangling pointers to populated docs so query cursor with populate() can garbage collect populated subdocs #9864
* fix(connection): pull correct `autoCreate` value from Mongoose global when creating new model before calling `connect()` #10091
* fix(populate): handle populating paths on documents with discriminator keys that point to non-existent discriminators #10082
* fix(index.d.ts): allow numbers as discriminator names #10115
* fix(index.d.ts): allow `type: Boolean` in Schema definitions #10085
* fix(index.d.ts): allow passing array of aggregation pipeline stages to `updateOne()` and `updateMany()` #10095
* fix(index.d.ts): support legacy 2nd param callback syntax for `deleteOne()`, `deleteMany()` #10122
* docs(mongoose): make `useCreateIndex` always `false` in docs #10033
* docs(schema): fix incorrect links from schema API docs #10111
5.12.4 / 2021-04-15
===================
* fix: upgrade mongodb driver -> 3.6.6 #10079
* fix: store fields set with select:false at schema-level when saving a new document #10101 [ptantiku](https://github.com/ptantiku)
* fix(populate): avoid turning already populated field to null when populating an existing lean document #10068 [IslandRhythms](https://github.com/IslandRhythms)
* fix(populate): correctly populate lean subdocs with `_id` property #10069
* fix(model): insertedDocs may contain docs that weren't inserted #10098 [olnazx](https://github.com/olnazx)
* fix(schemaType): make type Mixed cast error objects to pojos #10131 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(populate): support populating embedded discriminators in nested arrays #9984
* fix(populate): handle populating map paths using trailing `.$*` #10123
* fix(populate): allow returning primitive from `transform()` function for single conventional populate #10064
* fix(index.d.ts): allow generic classes of `T` to use `T & Document` internally #10046
* fix(index.d.ts): allow `$pull` with `$` paths #10075
* fix(index.d.ts): use correct `Date` type for `$currentDate` #10058
* fix(index.d.ts): add missing asyncInterator to Query type def #10094 [borfig](https://github.com/borfig)
* fix(index.d.ts): allow RHS of `$unset` properties to be any value #10066
* fix(index.d.ts): allow setting SchemaType `index` property to a string #10077
* refactor(index.d.ts): move discriminator() to common interface #10109 [LoneRifle](https://github.com/LoneRifle)
5.12.3 / 2021-03-31
===================
* fix: avoid setting schema-level collation on text indexes #10044 [IslandRhythms](https://github.com/IslandRhythms)
* fix(query): add `writeConcern()` method to avoid writeConcern deprecation warning #10009
* fix(connection): use queueing instead of event emitter for `createCollection()` and other helpers to avoid event emitter warning #9778
* fix(connection): scope `Connection#id` to Mongoose instance so id always lines up with `mongoose.connections` index #10025 [IslandRhythms](https://github.com/IslandRhythms)
* fix: avoid throwing in `promiseOrCallback()` if 3rd param isn't an EventEmitter #10055 [emrebass](https://github.com/emrebass)
* fix(index.d.ts): add Model as 2nd generic param to `Model.discriminator()` #10054 [coro101](https://github.com/coro101)
* fix(index.d.ts): add docs to `next()` callback for `pre('insertMany')` hooks #10078 #10072 [pezzu](https://github.com/pezzu)
* fix(index.d.ts): add `transform` to PopulateOptions interface #10061
* fix(index.d.ts): add DocumentQuery type for backwards compatibility #10036
5.12.2 / 2021-03-22
===================
* fix(QueryCursor): consistently execute `post('find')` hooks with an array of docs #10015 #9982 [IslandRhythms](https://github.com/IslandRhythms)
* fix(schema): support setting `ref` as an option on an array SchemaType #10029
* fix(query): apply schema-level `select` option from array schematypes #10029
* fix(schema): avoid possible prototype pollution with `Schema()` constructor #10035 [zpbrent](https://github.com/zpbrent)
* fix(model): make bulkWrite skip timestamps with timestamps: false #10050 [SoftwareSing](https://github.com/SoftwareSing)
* fix(index.d.ts): make query methods return `QueryWithHelpers` so query helpers pass through chaining #10040
* fix(index.d.ts): add `upserted` array to `updateOne()`, `updateMany()`, `update()` result #10042
* fix(index.d.ts): add back `Aggregate#project()` types that were mistakenly removed in 5.12.0 #10043
* fix(index.d.ts): always allow setting `type` in Schema to a SchemaType class or a Schema instance #10030
* docs(transactions): introduce `session.withTransaction()` before `session.startTransaction()` because `withTransaction()` is the recommended approach #10008
* docs(mongoose+browser): fix broken links to info about `mongoose.Types` #10016
5.12.1 / 2021-03-18
===================
* fix: update mongodb -> 3.6.5 to fix circular dependency warning #9900
* fix(document): make `toObject()` use child schema `flattenMaps` option by default #9995
* fix(ObjectId): make `isValidObjectId()` check that length 24 strings are hex chars only #10010 #9996 [IslandRhythms](https://github.com/IslandRhythms)
* fix(query): correctly cast embedded discriminator paths when discriminator key is specified in array filter #9977
* fix(schema): skip `populated()` check when calling `applyGetters()` with a POJO for mongoose-lean-getters support #9986
* fix(populate): support populating dotted subpath of a populated doc that has the same id as a populated doc #10005
* fix(index.d.ts): correct `this` for query helpers #10028 [francescov1](https://github.com/francescov1)
* fix(index.d.ts): avoid omitting function property keys in LeanDocuments, because TS can't accurately infer what's a function if using generic functions #9989
* fix(index.d.ts): correct type definition for `SchemaType#cast()` #10039 #9980
* fix(index.d.ts): make SchemaTypeOptions a class, add missing `SchemaType#OptionsConstructor` #10001
* fix(index.d.ts): support calling `findByIdAndUpdate()` with filter, update, callback params #9981
5.12.0 / 2021-03-11
===================
* feat(populate): add `transform` option that Mongoose will call on every populated doc #3775
* feat(query): make `Query#pre()` and `Query#post()` public #9784
* feat(document): add `Document#getPopulatedDocs()` to return an array of all populated documents in a document #9702 [IslandRhythms](https://github.com/IslandRhythms)
* feat(document): add `Document#getAllSubdocs()` to return an array of all single nested and array subdocuments #9764 [IslandRhythms](https://github.com/IslandRhythms)
* feat(schema): allow `schema` as a schema path name #8798 [IslandRhythms](https://github.com/IslandRhythms)
* feat(QueryCursor): Add batch processing for eachAsync #9902 [khaledosama999](https://github.com/khaledosama999)
* feat(connection): add `noListener` option to help with use cases where you're using `useDb()` on every request #9961
* feat(index): emit 'createConnection' event when user calls `mongoose.createConnection()` #9985
* feat(connection+index): emit 'model' and 'deleteModel' events on connections when creating and deleting models #9983
* feat(query): allow passing `explain` option to `Model.exists()` #8098 [IslandRhythms](https://github.com/IslandRhythms)
5.11.20 / 2021-03-11
====================
* fix(query+populate): avoid unnecessarily projecting in subpath when populating a path that uses an elemMatch projection #9973
* fix(connection): avoid `db` events deprecation warning with 'close' events #10004 #9930
* fix(index.d.ts): make `$pull` more permissive to allow dotted paths #9993
5.11.19 / 2021-03-05
====================
* fix(document): skip validating array elements that aren't modified when `validateModifiedOnly` is set #9963
* fix(timestamps): apply timestamps on `findOneAndReplace()` #9951
* fix(schema): correctly handle trailing array filters when looking up schema paths #9977
* fix(schema): load child class getter for virtuals instead of base class when using `loadClass()` #9975
* fix(index.d.ts): allow creating statics without passing generics to `Schema` constructor #9969
* fix(index.d.ts): add QueryHelpers generic to schema and model, make all query methods instead return QueryWithHelpers #9850
* fix(index.d.ts): support setting `type` to an array of schemas when using SchemaDefinitionType #9962
* fix(index.d.ts): add generic to plugin schema definition #9968 [emiljanitzek](https://github.com/emiljanitzek)
* docs: small typo fix #9964 [KrishnaMoorthy12](https://github.com/KrishnaMoorthy12)
5.11.18 / 2021-02-23
====================
* fix(connection): set connection state to `disconnected` if connecting string failed to parse #9921
* fix(connection): remove `db` events deprecation warning if `useUnifiedTopology = true` #9930
* fix(connection): fix promise chaining for openUri #9960 [lantw44](https://github.com/lantw44)
* fix(index.d.ts): add `PopulatedDoc` type to make it easier to define populated docs in interfaces #9818
* fix(index.d.ts): allow explicitly overwriting `toObject()` return type for backwards compatibility #9944
* fix(index.d.ts): correctly throw error when interface path type doesn't line up with schema path type #9958 [ShadiestGoat](https://github.com/ShadiestGoat)
* fix(index.d.ts): remove `any` from `deleteX()` and `updateX()` query params and return values #9959 [btd](https://github.com/btd)
* fix(index.d.ts): add non-generic versions of `Model.create()` for better autocomplete #9928
* docs: correctly handle multiple `>` in API descriptions #9940
5.11.17 / 2021-02-17
====================
* fix(populate): handle `perDocumentLimit` when multiple documents reference the same populated doc #9906
* fix(document): handle directly setting embedded document array element with projection #9909
* fix(map): cast ObjectId to string inside of MongooseMap #9938 [HunterKohler](https://github.com/HunterKohler)
* fix(model): use schema-level default collation for indexes if index doesn't have collation #9912
* fix(index.d.ts): make `SchemaTypeOptions#type` optional again to allow alternative typeKeys #9927
* fix(index.d.ts): support `{ type: String }` in schema definition when using SchemaDefinitionType generic #9911
* docs(populate+schematypes): document the `$*` syntax for populating every entry in a map #9907
* docs(connection): clarify that `Connection#transaction()` promise resolves to a command result #9919
5.11.16 / 2021-02-12
====================
* fix(document): skip applying array element setters when init-ing an array #9889
* fix: upgrade to mongodb driver 3.6.4 #9893 [jooeycheng](https://github.com/jooeycheng)
* fix: avoid copying Object.prototype properties when cloning #9876
* fix(aggregate): automatically convert functions to strings when using `$function` operator #9897
* fix: call pre-remove hooks for subdocuments #9895 #9885 [IslandRhythms](https://github.com/IslandRhythms)
* docs: fix confusing sentence in Schema docs #9914 [namenyi](https://github.com/namenyi)
5.11.15 / 2021-02-03
====================
* fix(document): fix issues with `isSelected` as an path in a nested schema #9884 #9873 [IslandRhythms](https://github.com/IslandRhythms)
* fix(index.d.ts): better support for `SchemaDefinition` generics when creating schema #9863 #9862 #9789
* fix(index.d.ts): allow required function in array definition #9888 [Ugzuzg](https://github.com/Ugzuzg)
* fix(index.d.ts): reorder create typings to allow array desctructuring #9890 [Ugzuzg](https://github.com/Ugzuzg)
* fix(index.d.ts): add missing overload to Model.validate #9878 #9877 [jonamat](https://github.com/jonamat)
* fix(index.d.ts): throw compiler error if schema says path is a String, but interface says path is a number #9857
* fix(index.d.ts): make `Query` a class, allow calling `Query#where()` with object argument and with no arguments #9856
* fix(index.d.ts): support calling `Schema#pre()` and `Schema#post()` with options and array of hooked function names #9844
* docs(faq): mention other debug options than console #9887 [dandv](https://github.com/dandv)
* docs(connections): clarify that Mongoose can emit 'error' both during initial connection and after initial connection #9853
5.11.14 / 2021-01-28
====================
* fix(populate): avoid inferring `justOne` from parent when populating a POJO with a manually populated path #9833 [IslandRhythms](https://github.com/IslandRhythms)
* fix(document): apply setters on each element of the array when setting a populated array #9838
* fix(map): handle change tracking on maps of subdocs #9811 [IslandRhythms](https://github.com/IslandRhythms)
* fix(document): remove dependency on `documentIsSelected` symbol #9841 [IslandRhythms](https://github.com/IslandRhythms)
* fix(error): make ValidationError.toJSON to include the error name correctly #9849 [hanzki](https://github.com/hanzki)
* fix(index.d.ts): indicate that `Document#remove()` returns a promise, not a query #9826
* fix(index.d.ts): allow setting `SchemaType#enum` to TypeScript enum with `required: true` #9546
5.11.13 / 2021-01-20
====================
* fix(map): handle change tracking on map of arrays #9813
* fix(connection): allow passing options to `Connection#transaction()` #9834 [pnutmath](https://github.com/pnutmath)
* fix(index.d.ts): make `Query#options#rawResult` take precedence over `new`+`upsert` #9816
* fix(index.d.ts): changed setOptions's 'overwrite' argument to optional #9824 [pierissimo](https://github.com/pierissimo)
* fix(index.d.ts): allow setting `mongoose.Promise` #9820
* fix(index.d.ts): add `Aggregate#replaceRoot()` #9814
* fix(index.d.ts): make `Model.create()` with a spread return a promise of array rather than single doc #9817
* fix(index.d.ts): use SchemaDefinitionProperty generic for SchemaTypeOptions if specified #9815
* docs(populate): add note about setting `toObject` for populate virtuals #9822
5.11.12 / 2021-01-14
====================
* fix(document): handle using `db` as a document path #9798
* fix(collection): make sure to call `onOpen()` if `autoCreate === false` #9807
* fix(index.d.ts): correct query type for `findOneAndUpdate()` and `findByIdAndUpdate()` with `rawResult = true` #9803
* fix(index.d.ts): require setting `new: true` or `returnOriginal: false` to skip null check with `findOneAndUpdate()` #9654
* fix(index.d.ts): make methods and statics optional on schema #9801
* fix(index.d.ts): remove non backwards compatible methods restriction #9801
* docs: removed the extra word on comment doc #9794 [HenriqueLBorges](https://github.com/HenriqueLBorges)
5.11.11 / 2021-01-08
====================
* fix(model): support calling `create()` with `undefined` as first argument and no callback #9765
* fix(index.d.ts): ensure TypeScript knows that `this` refers to `DocType` in schema methods with strict mode #9755
* fix(index.d.ts): make SchemaDefinition accept a model generic #9761 [mroohian](https://github.com/mroohian)
* fix(index.d.ts): add `Aggregate#addFields()` #9774
* fix(index.d.ts): allow setting `min` and `max` to [number, string] and [Date, string] #9762
* fix(index.d.ts): improve context and type bindings for `Schema#methods` and `Schema#statics` #9717
* docs: add recommended connection option #9768 [Fernando-Lozano](https://github.com/Fernando-Lozano)
* chore: correct improper date in History.md #9783 [botv](https://github.com/botv)
5.11.10 / 2021-01-04
====================
* fix(model): support `populate` option for `insertMany()` as a workaround for mongoose-autopopulate #9720
* perf(schema): avoid creating extra array when initializing array of arrays #9588
* perf(schema): avoid setting `arrayPath` when casting to a non-array, avoid unnecessarily setting atomics #9588
* perf(schema): avoid expensive `String#slice()` call when creating a new array #9588
* fix(queryhelpers): avoid modifying `lean.virtuals` in place #9754
* fix: fall back to legacy treatment for square brackets if square brackets contents aren't a number #9640
* fix(document): make fix for #9396 handle null values more gracefully #9709
* fix(index.d.ts): add missing overloaded function for Document#populate() #9744 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): allow Model.create param1 overwrite #9753 [hasezoey](https://github.com/hasezoey)
* fix(index.d.ts): improve autocomplete for query middleware #9752 [3Aahmednaser94](https://github.com/3Aahmednaser94)
* fix(index.d.ts): add missing function for Aggregate#group() #9750 [coro101](https://github.com/coro101)
* fix(index.d.ts): add missing `Aggregate#project()` #9763 [vorticalbox](https://github.com/vorticalbox)
* fix(index.d.ts): allow `null` as an enum value for schematypes #9746
* docs(guide+schema): make schema API docs and guide docs' list of Schema options line up #9749
* docs(documents): add some more details about what the `save()` promise resolves to #9689
* docs(subdocs): add section about subdocument defaults #7291
* chore: run GitHub CI on PRs and update badge #9760 [YC](https://github.com/YC)
5.11.9 / 2020-12-28
===================
* fix(document): keeps atomics when assigning array to filtered array #9651
* fix(document): apply `defaults` option to subdocument arrays #9736
* fix(index.d.ts): allow passing generic parameter to overwrite `lean()` result type #9728
* fix(index.d.ts): add missing pre hook for findOneAndUpdate #9743 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): schema methods & statics types #9725
* fix(index.d.ts): allow `id` paths with non-string values in TypeScript #9723
* fix(index.d.ts): support calling `createIndexes()` and `ensureIndexes()` with just callback #9706
* fix(index.d.ts): include `__v` in LeanDocuments #9687
* fix(index.d.ts): add missing `Aggregate#append()` #9714
* chore: add eslint typescript support and lint index.d.ts file #9729 [simllll](https://github.com/simllll)
* chore: add Github Actions #9688 [YC](https://github.com/YC)
5.11.8 / 2020-12-14
===================
* fix(index.d.ts): add missing single document populate #9696 [YC](https://github.com/YC)
* fix(index.d.ts): make options optional for `toObject` #9700
* fix(index.d.ts): added missing match and model methods in Aggregate class #9710 [manekshms](https://github.com/manekshms)
* fix(index.d.ts): make options optional for `createIndexes()` and `ensureIndexes()` #9706
* fix(index.d.ts): support passing a function to `ValidateOpts.message` #9697
* docs: add media query for ::before on headings #9705 #9704 [YC](https://github.com/YC)
5.11.7 / 2020-12-10
===================
* fix(document): ensure calling `get()` with empty string returns undefined for mongoose-plugin-autoinc #9681
* fix(model): set `isNew` to false for documents that were successfully inserted by `insertMany` with `ordered = false` when an error occurred #9677
* fix(index.d.ts): add missing Aggregate#skip() & Aggregate#limit() #9692 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): make `Document#id` optional so types that use `id` can use `Model<IMyType & Document>` #9684
5.11.6 / 2020-12-09
===================
* fix(middleware): ensure sync errors in pre hooks always bubble up to the calling code #9659
* fix(index.d.ts): allow passing ObjectId properties as strings to `create()` and `findOneAndReplace()` #9676
* fix(index.d.ts): allow calling `mongoose.model()` and `Connection#model()` with model as generic param #9685 #9678 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): Fix return type of Model#aggregate() #9680 [orgads](https://github.com/orgads)
* fix(index.d.ts): optional next() parameter for post middleware #9683 [isengartz](https://github.com/isengartz)
* fix(index.d.ts): allow array of validators in SchemaTypeOptions #9686 [cjroebuck](https://github.com/cjroebuck)
5.11.5 / 2020-12-07
===================
* fix(map): support `null` in maps of subdocs #9628
* fix(index.d.ts): support object syntax for `validate` #9667
* fix(index.d.ts): Allow number for Schema expires #9670 [alecgibson](https://github.com/alecgibson)
* fix(index.d.ts): allow definining arbitrary properties on SchemaTypeOpts for plugins like mongoose-autopopulate #9669
* fix(index.d.ts): add mongoose.models #9661 #9660 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(index.d.ts): allow the next() argument to be optional #9665 #9664 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): add missing `VirtualType#applyGetters()` and `applySetters()`, `Schema#virtuals`, `Schema#childSchemas`, `Query#_mongooseOptions` #9658
* fix(index.d.ts): add `id` to LeanDocuments in case it is defined in the user's schema #9657
* fix(index.d.ts): add missing types for hook functions #9653
* fix(index.d.ts): improve support for strict null checks with `upsert` and `orFail()` #9654
* fix(index.d.ts): make return values for `insertMany()` more consistent #9662
* fix(index.d.ts): Change options in Connection#collection() to be optional #9663 [orgads](https://github.com/orgads)
* fix(index.d.ts): add the missing generic declaration for Schema #9655 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): add missing `SchemaTypeOpts` and `ConnectionOptions` aliases for backwards compat
* docs(populate): remove `sort()` from `limit` example to avoid potential confusion #9584
* docs(compatibility): add MongoDB server 4.4 version compatibility #9641
5.11.4 / 2020-12-04
===================
* fix(index.d.ts): add `Document#__v` so documents have a Version by default #9652 [sahasayan](https://github.com/sahasayan)
* fix(index.d.ts): add missing `session` option to `SaveOptions` #9642
* fix(index.d.ts): add `Schema#paths`, `Schema#static(obj)`, `Embedded#schema`, `DocumentArray#schema`, make Schema inherit from EventEmitter #9650
* fix(index.d.ts): order when cb is optional in method #9647 [CatsMiaow](https://github.com/CatsMiaow)
* fix(index.d.ts): use DocumentDefinition for `FilterQuery` #9649
* fix(index.d.ts): correct callback result types for `find()`, `findOne()`, `findById()` #9648
* fix(index.d.ts): remove `Document#parent()` method because it conflicts with existing user code #9645
* fix(index.d.ts): add missing `Connection#db` property #9643
* test(typescript): add `tsconfig.json` file for intellisense #9611 [alecgibson](https://github.com/alecgibson)
5.11.3 / 2020-12-03
===================
* fix(index.d.ts): make Mongoose collection inherit MongoDB collection #9637 #9630 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(index.d.ts): add `Document#_id` so documents have an id by default #9632
* fix(index.d.ts): allow inline schema definitions for nested properties #9639 [Green-Cat](https://github.com/Green-Cat)
* fix(index.d.ts): add support for missing error message definitions #9638 [SaifAlsabe](https://github.com/SaifAlsabe)
* fix(schema+discriminator): support defining recursive embedded discriminators by passing document array schematype to discriminator #9600
* fix(index.d.ts): make it possible to use `LeanDocument` with arrays #9620
* fix(index.d.ts): add `ModelUpdateOptions` as alias for `QueryOptions` for backwards compat #9637
5.11.2 / 2020-12-02
===================
* fix(index.d.ts): add missing query options and model `findById()` function #9626 #9620
* fix(index.d.ts): support defining schema paths as arrays of functions #9617
* fix(index.d.ts): add automatic `_id` for Document, support creating Mongoose globals and accessing collection name #9618
* fix(index.d.ts): add missing global `get()` and `set()` #9616
* fix(index.d.ts): add missing `new` and `returnOriginal` options to QueryOptions, add missing model static properties #9627 #9616 #9615
* fix(index.d.ts): allow `useCreateIndex` in connection options #9621
5.11.1 / 2020-12-01