Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
===================
* fix(index.d.ts): add missing SchemaOptions #9606
* fix(index.d.ts): allow using `$set` in updates #9609
* fix(index.d.ts): add support for using return value of `createConnection()` as a connection as well as a promise #9612 #9610 [alecgibson](https://github.com/alecgibson)
* fix(index.d.ts): allow using `Types.ObjectId()` without `new` in TypeScript #9608
5.11.0 / 2020-11-30
===================
* feat: add official TypeScript definitions `index.d.ts` file #8108
* feat(connection): add bufferTimeoutMS option that configures how long Mongoose will allow commands to buffer #9469
* feat(populate): support populate virtuals with `localField` and `foreignField` as arrays #6608
* feat(populate+virtual): feat: support getters on populate virtuals, including `get` option for `Schema#virtual()` #9343
* feat(populate+schema): add support for `populate` schematype option that sets default populate options #6029
* feat(QueryCursor): execute post find hooks for each doc in query cursor #9345
* feat(schema): support overwriting cast logic for individual schematype instances #8407
* feat(QueryCursor): make cursor `populate()` in batch when using `batchSize` #9366 [biomorgoth](https://github.com/biomorgoth)
* chore: remove changelog from published bundle #9404
* feat(model+mongoose): add `overwriteModels` option to bypass `OverwriteModelError` globally #9406
* feat(model+query): allow defining middleware for all query methods or all document methods, but not other middleware types #9190
* feat(document+model): make change tracking skip saving if new value matches last saved value #9396
* perf(utils): major speedup for `deepEqual()` on documents and arrays #9396
* feat(schema): support passing a TypeScript enum to `enum` validator in schema #9547 #9546 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(debug): #8963 `shell` option for date format (ISODate) #9532 [FlameFractal](https://github.com/FlameFractal)
* feat(document): support square bracket indexing for `get()`, `set()` #9375
* feat(document): support array and space-delimited syntax for `Document#$isValid()`, `isDirectSelected()`, `isSelected()`, `$isDefault()` #9474
* feat(string): make `minLength` and `maxLength` behave the same as `minlength` and `maxlength` #8777 [m-weeks](https://github.com/m-weeks)
* feat(document): add `$parent()` as an alias for `parent()` for documents and subdocuments to avoid path name conflicts #9455
5.10.19 / 2020-11-30
====================
* fix(query): support passing an array to `$type` in query filters #9577
* perf(schema): avoid creating unnecessary objects when casting to array #9588
* docs: make example gender neutral #9601 [rehatkathuria](https://github.com/rehatkathuria)
5.10.18 / 2020-11-29
====================
* fix(connection): connect and disconnect can be used destructured #9598 #9597 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.10.17 / 2020-11-27
====================
* fix(document): allow setting fields after an undefined field #9587 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.10.16 / 2020-11-25
====================
* fix(connection): copy config options from connection rather than base connection when calling `useDb()` #9569
* fix(schema): support `of` for array type definitions to be consistent with maps #9564
* docs(dates): fix broken example reference #9557 [kertof](https://github.com/kertof)
* docs(virtualtype): remove unintentional h2 tag re: tj/dox#60 #9568
5.10.15 / 2020-11-16
====================
* fix(array): make sure `Array#toObject()` returns a vanilla JavaScript array in Node.js 6+ #9540
* fix(connection): make `disconnect()` stop Mongoose if it is trying to reconnect #9531
* fix: ensure `Document#overwrite()` correctly overwrites maps #9549
* fix(document): make transform work with nested paths #9544 #9543 [jonathan-wilkinson](https://github.com/jonathan-wilkinson)
* fix(query): maxTimeMS in count, countDocuments, distinct #9552 [FlameFractal](https://github.com/FlameFractal)
* fix(schema): remove warning re: `increment` as a schema path name #9538
* fix(model): automatically set `partialFilterExpression` for indexes in discriminator schemas #9542
5.10.14 / 2020-11-12
====================
* fix(update): handle casting immutable object properties with `$setOnInsert` #9537
* fix(discriminator): overwrite instead of merge if discriminator schema specifies a path is single nested but base schema has path as doc array #9534
* docs(middleware): clarify that you need to set both `document` and `query` on `remove` hooks to get just document middleware #9530 [mustafaKamal-fe](https://github.com/mustafaKamal-fe)
* docs(CONTRIBUTING): remove mmapv1 recommendation and clean up a few other details #9529
* refactor: remove duplicate function definition #9527 [ksullivan](https://github.com/ksullivan)
5.10.13 / 2020-11-06
====================
* fix: upgrade mongodb driver -> 3.6.3 for Lambda cold start fixes #9521 #9179 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(document): correctly handle setting props to other nested props #9519
5.10.12 / 2020-11-04
====================
* fix(connection): catch and report sync errors in connection wrappers like `startSession()` #9515
* fix(document): ignore getters when diffing values for change tracking #9501
* fix(connection): avoid executing promise handler unless it's a function #9507 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(error): throw more helpful error when connecting to a non-SSL MongoDB server with SSL enabled #9511
* docs(model+query): clarify that `deleteOne` and `deleteMany` trigger middleware #9504
* docs(ssl): add note about `ssl` defaulting to `true` for srv connection strings #9511
5.10.11 / 2020-10-26
====================
* fix(connection): when calling `mongoose.connect()` multiple times in parallel, make 2nd call wait for connection before resolving #9476
* fix(map): make `save()` persist `Map#clear()` #9493
* fix(document): avoid overwriting array subdocument when setting dotted path that isn't selected #9427
* fix(connection): don't throw Atlas error if server discovery doesn't find any servers #9470
* docs: update options for Model.findOneAndUpdate #9499 [radamson](https://github.com/radamson)
5.10.10 / 2020-10-23
====================
* fix(schema): handle merging schemas from separate Mongoose module instances when schema has a virtual #9471
* fix(connection): make connection.then(...) resolve to a connection instance #9497 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(aggregate): when using $search with discriminators, add `$match` as the 2nd stage in pipeline rather than 1st #9487
* fix(query): cast $nor within $elemMatch #9479
* docs(connection): add note about 'error' event versus 'disconnected' event #9488 [tareqdayya](https://github.com/tareqdayya)
5.10.9 / 2020-10-09
===================
* fix(update): strip out unused array filters to avoid "filter was not used in the update" error #9468
* fix(mongoose): allow setting `autoCreate` as a global option to be consistent with `autoIndex` #9466
5.10.8 / 2020-10-05
===================
* fix(schema): handle setting nested paths underneath single nested subdocs #9459
* fix(schema+index): allow calling `mongoose.model()` with schema from a different Mongoose module instance #9449
* fix(transaction): fix saving new documents w/ arrays in transactions #9457 [PenguinToast](https://github.com/PenguinToast)
* fix(document): track `reason` on cast errors that occur while init-ing a document #9448
* fix(model): make `createCollection()` not throw error when collection already exists to be consistent with v5.9 #9447
* docs(connections): add SSL connections docs #9443
* docs(query_casting): fix typo #9458 [craig-davis](https://github.com/craig-davis)
5.10.7 / 2020-09-24
===================
* fix(schema): set correct path and schema on nested primitive arrays #9429
* fix(document): pass document to required validator so `required` can use arrow functions #9435 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(document): handle required when schema has property named `isSelected` #9438
* fix(timestamps): allow using timestamps when schema has a property named 'set' #9428
* fix(schema): make `Schema#clone()` use parent Mongoose instance's Schema constructor #9426
5.10.6 / 2020-09-18
===================
* fix(populate): handle `options.perDocumentLimit` option same as `perDocumentLimit` when calling `populate()` #9418
* fix(document): invalidate path if default function throws an error #9408
* fix: ensure subdocument defaults run after initial values are set when initing #9408
* docs(faq+queries): add more detail about duplicate queries, including an faq entry #9386
* docs: replace var with let and const in docs and test files #9414 [jmadankumar](https://github.com/jmadankumar)
* docs(model+query): document using array of strings as projection #9413
* docs(middleware): add missing backtick #9425 [tphobe9312](https://github.com/tphobe9312)
5.10.5 / 2020-09-11
===================
* fix: bump mongodb -> 3.6.2 #9411 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(query+aggregate+cursor): support async iteration over a cursor instance as opposed to a Query or Aggregate instance #9403
* fix(document): respect child schema `minimize` if `toObject()` is called without an explicit `minimize` #9405
* docs(guide): use const instead of var #9394 [nainardev](https://github.com/nainardev)
* docs(query): link to lean, findOneAndUpdate, query casting tutorials from query docs #9410
5.10.4 / 2020-09-09
===================
* fix(document): allow setting nested path to instance of model #9392
* fix: handle `findOneAndRemove()` with `orFail()` #9381
* fix(schema): support setting `_id` option to `false` after instantiating schema #9390
* docs(document): fix formatting on `getChanges()` #9376
5.10.3 / 2020-09-03
===================
* fix: upgrade mongodb -> 3.6.1 #9380 [lamhieu-vk](https://github.com/lamhieu-vk)
* fix(populate): allow populating paths underneath subdocument maps #9359
* fix(update): handle casting map paths when map is underneath a single nested subdoc #9298
* fix(discriminator): avoid removing nested path if both base and discriminator schema have the same nested path #9362
* fix(schema): support `Schema#add()` with schematype instances with different paths #9370
* docs(api): fix typo in `Query#get()` example #9372 [elainewlin](https://github.com/elainewlin)
5.10.2 / 2020-08-28
===================
* fix(model): avoid uncaught error if `insertMany()` fails due to server selection error #9355
* fix(aggregate): automatically convert accumulator function options to strings #9364
* fix(document): handle `pull()` on a document array when `_id` is an alias #9319
* fix(queryhelpers): avoid path collision error when projecting in discriminator key with `.$` #9361
* fix: fix typo in error message thrown by unimplemented createIndex #9367 [timhaley94](https://github.com/timhaley94)
* docs(plugins): note that plugins should be applied before you call `mongoose.model()` #7723
5.10.1 / 2020-08-26
===================
* fix(mongoose): fix `.then()` is not a function error when calling `mongoose.connect()` multiple times #9358 #9335 #9331
* fix: allow calling `create()` after `bulkWrite()` by clearing internal casting context #9350
* fix(model): dont wipe out changes made while `save()` is in-flight #9327
* fix(populate): skip checking `refPath` if the path to populate is undefined #9340
* fix(document): allow accessing document values from function `default` on array #9351
* fix(model): skip applying init hook if called with `schema.pre(..., { document: false })` #9316
* fix(populate): support `retainNullValues` when setting `_id` to `false` for subdocument #9337 #9336 [FelixRe0](https://github.com/FelixRe0)
* docs: update connect example to avoid deprecation warnings #9332 [moander](https://github.com/moander)
5.10.0 / 2020-08-14
===================
* feat: upgrade to MongoDB driver 3.6 for full MongoDB 4.4 support
* feat(connection): add `Connection#transaction()` helper that handles resetting Mongoose document state if the transaction fails #8380
* feat(connection): make transaction() helper reset array atomics after failed transaction
* feat(schema+model): add `optimisticConcurrency` option to use OCC for `save()` #9001 #5424
* feat(aggregate): add `Aggregate#search()` for Atlas Text Search #9115
* feat(mongoose): add support for setting `setDefaultsOnInsert` as a global option #9036 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(mongoose): add support for setting `returnOriginal` as a global option #9189 #9183 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(mongoose): allow global option mongoose.set('strictQuery', true) #9016 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(document): add Document#getChanges #9097 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(document): support `defaults` option to disable adding defaults to a single document #8271
* feat(SingleNestedPath+DocumentArray): add static `set()` function for global options, support setting `_id` globally #8883
* feat(query): handle casting `$or` when each clause contains a different discriminator key #9018
* feat(query): add overwriteDiscriminatorKey option that allows changing the discriminator key in `findOneAndUpdate()`, `updateOne()`, etc. #6087
* fix(connection): make calling `mongoose.connect()` while already connected a no-op #9203
* feat(connection): add `getClient()` and `setClient()` function for interacting with a connection's underlying MongoClient instance #9164
* feat(document+populate): add `parent()` function that allows you to get the parent document for populated docs #8092
* feat(document): add `useProjection` option to `toObject()` and `toJSON()` for hiding deselected fields on newly created documents #9118
5.9.29 / 2020-08-13
===================
* fix(document): support setting nested path to itself when it has nested subpaths #9313
* fix(model): make `syncIndexes()` report error if it can't create an index #9303
* fix: handle auth error when Atlas username is incorrect #9300
5.9.28 / 2020-08-07
===================
* fix(connection): consistently stop buffering when "reconnected" is emitted #9295
* fix(error): ensure `name` and `message` show up on individual ValidatorErrors when calling JSON.stringify() on a ValidationError #9296
* fix(document): keeps manually populated paths when setting a nested path to itself #9293
* fix(document): allow saving after setting document array to itself #9266
* fix(schema): handle `match` schema validator with `/g` flag #9287
* docs(guide): refactor transactions examples to async/await #9204
5.9.27 / 2020-07-31
===================
* fix: upgrade mongodb driver -> 3.5.10 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(transactions): make transactions docs use async/await for readability #9204
5.9.26 / 2020-07-27
===================
* fix(document): allow unsetting boolean field by setting the field to `undefined` #9275
* fix(document): throw error when overwriting a single nested subdoc changes an immutable path within the subdoc #9281
* fix(timestamps): apply timestamps to `bulkWrite()` updates when not using `$set` #9268
* fix(browser): upgrade babel to v7 to work around an issue with `extends Error` #9273
* fix: make subdocument's `invalidate()` methods have the same return value as top-level document #9271
* docs(model): make `create()` docs use async/await, and add another warning about how `create()` with options requires array syntax #9280
* docs(connections): clarify that Mongoose can emit 'connected' when reconnecting after losing connectivity #9240
* docs(populate): clarify that you can't filter based on foreign document properties when populating #9279
* docs(document+model): clarify how `validateModifiedOnly` option works #9263
* docs: remove extra poolSize option in comment #9270 [shahvicky](https://github.com/shahvicky)
* docs: point bulkWrite() link to mongoose docs instead of localhost #9284
5.9.25 / 2020-07-17
===================
* fix(discriminator): allow passing a compiled model's schema as a parameter to `discriminator()` #9238
* fix(connection): throw more readable error when querying db before initial connection when `bufferCommands = false` #9239
* fix(indexes): don't unnecessarily drop text indexes when running `syncIndexes()` #9225
* fix: make Boolean _castNullish respect omitUndefined #9242 [ehpc](https://github.com/ehpc)
* fix(populate): populate single nested discriminator underneath doc array when populated docs have different model but same id #9244
* docs(mongoose): correct formatting typo #9247 [JNa0](https://github.com/JNa0)
5.9.24 / 2020-07-13
===================
* fix(connection): respect connection-level `bufferCommands` option if `mongoose.connect()` is called after `mongoose.model()` #9179
* fix(document): clear out `priorDoc` after overwriting single nested subdoc so changes after overwrite get persisted correctly #9208
* fix(connection): dont overwrite user-specified `bufferMaxEntries` when setting `bufferCommands` #9218
* fix(model): allow passing projection to `Model.hydrate()` #9209
* fix(schema+document): support adding `null` to schema boolean's `convertToFalse` set #9223
* docs(model): make `find` and `findOne()` examples use async/await and clarify `find({})` is find all #9210
4.13.21 / 2020-07-12
====================
* fix(query): delete top-level `_bsontype` property in queries to prevent silent empty queries #8222
5.9.23 / 2020-07-10
===================
* fix(model): fix `syncIndexes()` error when db index has a collation but Mongoose index does not #9224 [clhuang](https://github.com/clhuang)
* fix(array): only cast array to proper depth if it contains an non-array value #9217 #9215 [cyrilgandon](https://github.com/cyrilgandon)
* docs(schematype): document the `transform` option #9211
* docs(mongoose): fix typo #9212 [JNa0](https://github.com/JNa0)
5.9.22 / 2020-07-06
===================
* fix(schema): treat `{ type: mongoose.Schema.Types.Array }` as equivalent to `{ type: Array }` #9194
* fix: revert fix for #9107 to avoid issues when calling `connect()` multiple times #9167
* fix(update): respect storeSubdocValidationError option with update validators #9172
* fix: upgrade to safe-buffer 5.2 #9198
* docs: add a note about SSL validation to migration guide #9147
* docs(schemas): fix inconsistent header #9196 [samtsai15](https://github.com/samtsai15)
5.9.21 / 2020-07-01
===================
* fix: propagate `typeKey` option to implicitly created schemas from `typePojoToMixed` #9185 [joaoritter](https://github.com/joaoritter)
* fix(populate): handle embedded discriminator `refPath` with multiple documents #9153
* fix(populate): handle deselected foreign field with `perDocumentLimit` and multiple documents #9175
* fix(document): disallow `transform` functions that return promises #9176 #9163 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(document): use strict equality when checking mixed paths for modifications #9165
* docs: add target="_blank" to all edit links #9058
5.9.20 / 2020-06-22
===================
* fix(populate): handle populating primitive array under document array discriminator #9148
* fix(connection): make sure to close previous connection when calling `openUri()` on an already open connection #9107
* fix(model): fix conflicting $setOnInsert default values with `update` values in bulkWrite #9160 #9157 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(validation): add note about validateBeforeSave and invalidate #9144 [dandv](https://github.com/dandv)
* docs: specify the array field syntax for invalidate #9137 [dandv](https://github.com/dandv)
* docs: fix several typos and broken references #9024 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: fix minor typo #9143 [dandv](https://github.com/dandv)
5.9.19 / 2020-06-15
===================
* fix: upgrade mongodb driver -> 3.5.9 #9124 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix: copy `required` validator on single nested subdoc correctly when calling `Schema#clone()` #8819
* fix(discriminator): handle `tiedValue` when casting update on nested paths #9108
* fix(model): allow empty arrays for bulkWrite #9132 #9131 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(schema): correctly set partialFilterExpression for nested schema indexes #9091
* fix(castArrayFilters): handle casting on all fields of array filter #9122 [lafeuil](https://github.com/lafeuil)
* fix(update): handle nested path createdAt when overwriting parent path #9105
* docs(subdocs): add some notes on the difference between single nested subdocs and nested paths #9085
* docs(subdocs): improve docs on `typePojoToMixed` #9085
* docs: add note about connections in `globalSetup` with Jest #9063
* docs: add schema and how to set default sub-schema to schematype options #9111 [dfle](https://github.com/dfle)
* docs(index): use `const` instead of `var` in examples #9125 [dmcgrouther](https://github.com/dmcgrouther)
* docs: corrected markdown typo #9117
5.9.18 / 2020-06-05
===================
* fix: improve atlas error in the event of incorrect password #9095
* docs: add edit link for all docs pages #9058
* fix(document): allow accessing `$locals` when initializing document #9099 #9098 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(query): make `setDefaultsOnInsert` a mongoose option so it doesn't end up in debug output #9086
* docs(connection+index): add serverSelectionTimeoutMS and heartbeatFrequencyMS to `connect()` and `openUri()` options #9071
* docs(geojson): add notes about geojson 2dsphere indexes #9044
* docs: make active page bold in navbar #9062
* docs: correct a typo in a code snippet #9089 [Elvis-Sarfo](https://github.com/Elvis-Sarfo)
5.9.17 / 2020-06-02
===================
* fix(document): avoid tracking changes like `splice()` on slice()-ed arrays #9011
* fix(populate): make populating a nested path a no-op #9073
* fix(document): clear nested cast errors when overwriting an array path #9080
* fix: upgrade mongodb to v3.5.8 #9069 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(document): add validateModifiedOnly to Document#save(), Document#validateSync() and Document#validate() #9078 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(faq): fix typo #9075 [tigransimonyan](https://github.com/tigransimonyan)
* docs: document all parameters to .debug #9029 [dandv](https://github.com/dandv)
* docs: fix property value in Getters example #9061 [ismet](https://github.com/ismet)
5.9.16 / 2020-05-25
===================
* perf(error): convert errors to classes extending Error for lower CPU overhead #9021 [zbjornson](https://github.com/zbjornson)
* fix(query): throw CastError if filter `$and`, `$or`, `$nor` contain non-object values #8948
* fix(bulkwrite): cast filter & update to schema after applying timestamps #9030 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(document): don't overwrite defaults with undefined keys in nested documents #9039 [vitorhnn](https://github.com/vitorhnn)
* fix(discriminator): remove discriminator schema nested paths pulled from base schema underneath a mixed path in discriminator schema #9042
* fix(model): make syncIndexes() not drop index if all user-specified collation options are the same #8994
* fix(document): make internal `$__.scope` property a symbol instead to work around a bug with fast-safe-stringify #8955
* docs: model.findByIdAndUpdate() 'new' param fix #9026 [dandv](https://github.com/dandv)
5.9.15 / 2020-05-18
===================
* fix(schema): treat creating dotted path with no parent as creating a nested path #9020
* fix(documentarray): make sure you can call `unshift()` after `map()` #9012 [philippejer](https://github.com/philippejer)
* fix(model): cast bulkwrite according to discriminator schema if discriminator key is present #8982 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(schema): remove `db` from reserved keywords #8940
* fix(populate): treat populating a doc array that doesn't have a `ref` as a no-op #8946
* fix(timestamps): set createdAt and updatedAt on doubly nested subdocs when upserting #8894
* fix(model): allow POJOs as schemas for model.discriminator(...) #8991 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(model): report `insertedDocs` on `insertMany()` errors #8938
* fix(model): ensure consistent `writeErrors` property on insertMany error with `ordered: false`, even if only one op failed #8938
* docs: add anchor tag to strictQuery and strict #9014 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(faq): remove faq ipv6 #9004
* docs: add note about throwing error only after validation and fix broken reference to api/CastError #8993 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: fix typos in documents.pug #9005 [dandv](https://github.com/dandv)
5.9.14 / 2020-05-13
===================
* fix(cursor): add index as second parameter to eachAsync callback #8972 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(query): cast filter according to discriminator schema if discriminator key in filter #8881
* fix(model): fix throwing error when populating virtual path defined on child discriminator #8924 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(errors): handle case when user has make `Error.prototype.toJSON` read only #8986 [osher](https://github.com/osher)
* fix(model): add `kind` to cast errors thrown by query execution #8953 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(update): use child schema strict on single nested updates if useNestedStrict not set #8922
* docs(model): improve `save()` docs #8956 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: add immutable type to Schema Types #8987 [Andrew5569](https://github.com/Andrew5569)
* docs: sort schema reserved keys in documentation #8966 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.9.13 / 2020-05-08
===================
* fix(schema): mark correct path as modified when setting a path underneath a nested array of documents #8926
* fix(query): Query#select({ field: false }) should not overwrite schema selection options #8929 #8923
* fix(update): handle immutable properties are ignored in bulk upserts #8952 [philippejer](https://github.com/philippejer)
* docs(browser): add back sample webpack config #8890
* docs(faq): fix broken reference in limit vs perDocumentLimit #8937
5.9.12 / 2020-05-04
===================
* fix(document): report cast error on array elements with array index instead of just being a cast error for the whole array #8888
* fix(connection): throw more helpful error in case of IP whitelisting issue with Atlas #8846
* fix(schema): throw error on schema with reserved key with type of object #8869 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(connection): inherit config for useDB from default connection #8267 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(query): set mongodb options for `distinct()` #8906 [clhuang](https://github.com/clhuang)
* fix(schema): allow adding descending indexes on schema #8895 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(document): set defaults if setting nested path to empty object with `minimize: false` #8829
* fix(populate): check discriminator existence before accessing schema in getModelsMapForPopulate #8837 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: fix broken references to Mongoose#Document API, and prefer mongoose.model(...) over Document#model(...) #8914 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(model): adds options.limit to Model.insertMany(...) #8864 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: add flattenMaps and aliases to Document#toObject() #8901 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(model): add options.overwrite to findOneAndUpdate #8865 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(populate+faq): separate limit-vs-perDocumentLimit into its own section, add FAQ for populate and limit #8917 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.9.11 / 2020-04-30
===================
* fix: upgrade mongodb driver -> 3.5.7 #8842 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix: validate nested paths on Model.validate(...) #8848 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(populate): make doc.execPopulate(options) a shorthand for doc.populate(options).execPopulate() #8840 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(model): return validation errors when all docs are invalid & rawResult set #8853 [tusharf5](https://github.com/tusharf5)
* fix(schemaType): treat select: null or select: undefined as not specified #8850 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix: fix stream close event listener being called multiple times in Node 14 #8835 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(populate): handle `clone` with `lean` when setting a path to `null` #8807
* docs(faq): clarify setting paths under document arrays with `markModified()` #8854
* docs: fix race condition in creating connection for lambda #8845 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: add options.path for Model.populate(...) #8833 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: use ES6 classes for custom schema type example #8802
5.9.10 / 2020-04-20
===================
* fix: upgrade mongodb -> 3.5.6, bson -> 1.1.4 #8719
* fix(document): avoid calling `$set()` on object keys if object path isn't in schema #8751
* fix(timestamps): handle timestamps on doubly nested subdocuments #8799
* fix(schematype): throw error if default is set to a schema instance #8751
* fix: handle $elemMatch projection with `select: false` in schema #8818 #8806 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs: make FAQ questions more linkable #8825 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(validation): use `init()` as opposed to `once('index')` in `unique` example #8816
* docs: clarify `insertMany()` return value #8820 [dandv](https://github.com/dandv)
* docs(populate+query): fix typos #8793 #8794 [dandv](https://github.com/dandv)
* docs(model): document skipId parameter #8791 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.9.9 / 2020-04-13
==================
* fix(model): make Model.bulkWrite accept `strict` option #8782 #8788 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(virtual): make populated virtual getter return value when it is passed in #8775 #8774 [makinde](https://github.com/makinde)
* fix(document): handle validating document array whose docs contain maps and nested paths #8767
* fix(document): skip discriminator key when overwriting a document #8765
* fix(populate): support `clone` option with `lean` #8761 #8760
* docs(transactions): use `endSession()` in all transactions examples #8741
* docs(queries): expand streaming section to include async iterators, cursor timeouts, and sesssion idle timeouts #8720
* docs(model+query+findoneandupdate): add docs for `returnOriginal` option #8766
* docs(model): fix punctuation #8788 [dandv](https://github.com/dandv)
* docs: fix typos #8780 #8799 [dandv](https://github.com/dandv)
5.9.8 / 2020-04-06
==================
* fix(map): run getters when calling `Map#get()` #8730
* fix(populate): handle `refPath` function in embedded discriminator #8731
* fix(model): allow setting timestamps to false for bulkWrite #8758 #8745 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(model): pass custom options to `exists()` when no changes to save #8764 #8739 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(update): respect `useNestedStrict: false` when updating a single nested path #8735
* fix(schema): allow `modelName` as a schema path, since `modelName` is a static property on models #7967
* docs(promises): add section about using `exec()` with queries and `await` #8747
* docs(connections): clarify that `connectTimeoutMS` doesn't do anything with `useUnifiedTopology`, should use `serverSelectionTimeoutMS` #8721
* chore: upgrade mpath -> 0.7.0 #8762 [roja548](https://github.com/roja548)
5.9.7 / 2020-03-30
==================
* fix(map): avoid infinite loop when setting a map of documents to a document copied using spread operator #8722
* fix(query): clean stack trace for filter cast errors so they include the calling file #8691
* fix(model): make bulkWrite updates error if `strict` and `upsert` are set and `filter` contains a non-schema path #8698
* fix(cast): make internal `castToNumber()` allow undefined #8725 [p3x-robot](https://github.com/p3x-robot)
5.9.6 / 2020-03-23
==================
* fix(document): allow saving document with nested document array after setting `nestedArr.0` #8689
* docs(connections): expand section about multiple connections to describe patterns for exporting schemas #8679
* docs(populate): add note about `execPopulate()` to "populate an existing document" section #8671 #8275
* docs: fix broken links #8690 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(guide): fix typos #8704 [MateRyze](https://github.com/MateRyze)
* docs(guide): fix minor typo #8683 [pkellz](https://github.com/pkellz)
5.9.5 / 2020-03-16
==================
* fix: upgrade mongodb driver -> 3.5.5 #8667 #8664 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(connection): emit "disconnected" after losing connectivity to every member of a replica set with `useUnifiedTopology: true` #8643
* fix(array): allow calling `slice()` after `push()` #8668 #8655 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(map): avoid marking map as modified if setting `key` to the same value #8652
* fix(updateValidators): don't run `Mixed` update validator on dotted path underneath mixed type #8659
* fix(populate): ensure top-level `limit` applies if one document being populated has more than `limit` results #8657
* fix(populate): throw error if both `limit` and `perDocumentLimit` are set #8661 #8658 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(findOneAndUpdate): add a section about the `rawResult` option #8662
* docs(guide): add section about `loadClass()` #8623
* docs(query): improve `Query#populate()` example to clarify that `sort` doesn't affect the original result's order #8647
5.9.4 / 2020-03-09
==================
* fix(document): allow `new Model(doc)` to set immutable properties when doc is a mongoose document #8642
* fix(array): make sure you can call `unshift()` after `slice()` #8482
* fix(schema): propagate `typePojoToMixed` to implicitly created arrays #8627
* fix(schema): also propagate `typePojoToMixed` option to schemas implicitly created because of `typePojoToMixed` #8627
* fix(model): support passing `background` option to `syncIndexes()` #8645
* docs(schema): add a section about the `_id` path in schemas #8625
* docs(virtualtype+populate): document using `match` with virtual populate #8616
* docs(guide): fix typo #8648 [sauzy34](https://github.com/sauzy34)
5.9.3 / 2020-03-02
==================
* fix: upgrade mongodb driver -> 3.5.4 #8620
* fix(document): set subpath defaults when overwriting single nested subdoc #8603
* fix(document): make calling `validate()` with single nested subpath only validate that single nested subpath #8626
* fix(browser): make `mongoose.model()` return a class in the browser to allow hydrating populated data in the browser #8605
* fix(model): make `syncIndexes()` and `cleanIndexes()` drop compound indexes with `_id` that aren't in the schema #8559
* docs(connection+index): add warnings to explain that bufferMaxEntries does nothing with `useUnifiedTopology` #8604
* docs(document+model+query): add `options.timestamps` parameter docs to `findOneAndUpdate()` and `findByIdAndUpdate()` #8619
* docs: fix out of date links to tumblr #8599
5.9.2 / 2020-02-21
==================
* fix(model): add discriminator key to bulkWrite filters #8590
* fix(document): when setting nested array path to non-nested array, wrap values top-down rather than bottom up when possible #8544
* fix(document): dont leave nested key as undefined when setting nested key to empty object with minimize #8565
* fix(document): avoid throwing error if setting path to Mongoose document with nullish `_doc` #8565
* fix(update): handle Binary type correctly with `runValidators` #8580
* fix(query): run `deleteOne` hooks only on `Document#deleteOne()` when setting `options.document = true` for `Schema#pre()` #8555
* fix(document): allow calling `validate()` in post validate hook without causing parallel validation error #8597
* fix(virtualtype): correctly copy options when cloning #8587
* fix(collection): skip creating capped collection if `autoCreate` set to `false` #8566
* docs(middleware): clarify that updateOne and deleteOne hooks are query middleware by default, not document middleware #8581
* docs(aggregate): clarify that `Aggregate#unwind()` can take object parameters as well as strings #8594
5.9.1 / 2020-02-14
==================
* fix(model): set session when calling `save()` with no changes #8571
* fix(schema): return correct pathType when single nested path is embedded under a nested path with a numeric name #8583
* fix(queryhelpers): remove `Object.values()` for Node.js 4.x-6.x support #8596
* fix(cursor): respect sort order when using `eachAsync()` with `parallel` and a sync callback #8577
* docs: update documentation of custom _id overriding in discriminators #8591 [sam-mfb](https://github.com/sam-mfb)
5.9.0 / 2020-02-13
==================
* fix: upgrade to MongoDB driver 3.5 #8520 #8563
* feat(schematype): support setting default options for schema type (`trim` on all strings, etc.) #8487
* feat(populate): add `perDocumentLimit` option that limits per document in `find()` result, rather than across all documents #7318
* feat(schematype): enable setting `transform` option on individual schematypes #8403
* feat(timestamps): allow setting `currentTime` option for setting custom function to get the current time #3957
* feat(connection): add `Connection#watch()` to watch for changes on an entire database #8425
* feat(document): add `Document#$op` property to make it easier to tell what operation is running in middleware #8439
* feat(populate): support `limit` as top-level populate option #8445
5.8.13 / 2020-02-13
===================
* fix(populate): use safe get to avoid crash if schematype doesn't have options #8586
5.8.12 / 2020-02-12
===================
* fix(query): correctly cast dbref `$id` with `$elemMatch` #8577
* fix(populate): handle populating when some embedded discriminator schemas have `refPath` but none of the subdocs have `refPath` #8553
* docs: add useUnifiedTopology to homepage example #8558 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* refactor(utils): moving promiseOrCallback to helpers/promiseOrCallback #8573 [hugosenari](https://github.com/hugosenari)
5.8.11 / 2020-01-31
===================
* fix(document): allow calling `validate()` multiple times in parallel on subdocs to avoid errors if Mongoose double-validates [taxilian](https://github.com/taxilian) #8548 #8539
* fix(connection): allow calling initial `mongoose.connect()` after connection helpers on the same tick #8534
* fix(connection): throw helpful error when callback param to `mongoose.connect()` or `mongoose.createConnection()` is not a function #8556
* fix(drivers): avoid unnecessary caught error when importing #8528
* fix(discriminator): remove unnecessary `utils.merge()` [samgladstone](https://github.com/samgladstone) #8542
* docs: add "built with mongoose" page #8540
5.8.10 / 2020-01-27
===================
* perf(document): improve performance of document creation by skipping unnecessary split() calls #8533 [igrunert-atlassian](https://github.com/igrunert-atlassian)
* fix(document): only call validate once for deeply nested subdocuments #8532 #8531 [taxilian](https://github.com/taxilian)
* fix(document): create document array defaults in forward order, not reverse #8514
* fix(document): allow function as message for date min/max validator #8512
* fix(populate): don't try to populate embedded discriminator that has populated path but no `refPath` #8527
* fix(document): plugins from base schema when creating a discriminator #8536 [samgladstone](https://github.com/samgladstone)
* fix(document): ensure parent and ownerDocument are set for subdocs in document array defaults #8509
* fix(document): dont set undefined keys to null if minimize is false #8504
* fix(update): bump timestamps when using update aggregation pipelines #8524
* fix(model): ensure `cleanIndexes()` drops indexes with different collations #8521
* docs(model): document `insertMany` `lean` option #8522
* docs(connections): document `authSource` option #8517
5.8.9 / 2020-01-17
==================
* fix(populate): skip populating embedded discriminator array values that don't have a `refPath` #8499
* docs(queries): clarify when to use queries versus aggregations #8494
5.8.8 / 2020-01-14
==================
* fix(model): allow using `lean` with `insertMany()` #8507 #8234 [ntsekouras](https://github.com/ntsekouras)
* fix(document): don't throw parallel validate error when validating subdoc underneath modified nested path #8486
* fix: allow `typePojoToMixed` as top-level option #8501 #8500 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(populate+schematypes): make note of `_id` getter for ObjectIds in populate docs #8483
5.8.7 / 2020-01-10
==================
* fix(documentarray): modify ownerDocument when setting doc array to a doc array thats part of another document #8479
* fix(document): ensure that you can call `splice()` after `slice()` on an array #8482
* docs(populate): improve cross-db populate docs to include model refs #8497
5.8.6 / 2020-01-07
====================
* chore: merge changes from 4.13.20 and override mistaken publish to latest tag
4.13.20 / 2020-01-07
====================
* fix(schema): make aliases handle mongoose-lean-virtuals #6069
5.8.5 / 2020-01-06
==================
* fix(document): throw error when running `validate()` multiple times on the same document #8468
* fix(model): ensure deleteOne() and deleteMany() set discriminator filter even if no conditions passed #8471
* fix(document): allow pre('validate') hooks to throw errors with `name = 'ValidationError'` #8466
* fix(update): move top level $set of immutable properties to $setOnInsert so upserting with immutable properties actually sets the property #8467
* fix(document): avoid double-running validators on single nested subdocs within single nested subdocs #8468
* fix(populate): support top-level match option for virtual populate #8475
* fix(model): avoid applying skip when populating virtual with count #8476
5.8.4 / 2020-01-02
==================
* fix(populate): ensure populate virtual gets set to empty array if `localField` is undefined in the database #8455
* fix(connection): wrap `mongoose.connect()` server selection timeouts in MongooseTimeoutError for more readable stack traces #8451
* fix(populate): allow deselecting `foreignField` from projection by prefixing with `-` #8460
* fix(populate): support embedded discriminators with `refPath` when not all discriminator schemas have `refPath` #8452
* fix(array): allow defining `enum` on array if an array of numbers #8449
5.8.3 / 2019-12-23
==================
* fix: upgrade mongodb -> 3.4.1 #8430 [jaschaio](https://github.com/jaschaio)
* fix(populate): don't add empty subdocument to array when populating path underneath a non-existent document array #8432
* fix(schema): handle `_id` option for document array schematypes #8450
* fix(update): call setters when updating mixed type #8444
* docs(connections): add note about MongoTimeoutError.reason #8402
5.8.2 / 2019-12-20
==================
* fix(schema): copy `.add()`-ed paths when calling `.add()` with schema argument #8429
* fix(cursor): pull schema-level readPreference when using `Query#cursor()` #8421
* fix(cursor): wait for all promises to resolve if `parallel` is greater than number of documents #8422
* fix(document): depopulate entire array when setting array path to a partially populated array #8443
* fix: handle setDefaultsOnInsert with deeply nested subdocs #8392
* fix(document): report `DocumentNotFoundError` if underlying document deleted but no changes made #8428 #8371 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* docs(populate): clarify limitations of `limit` option for populate and suggest workaround #8409
* docs(deprecations): explain which connection options are no longer relevant with useUnifiedTopology #8411
* chore: allow browser build to be published #8435 #8427 [captaincaius](https://github.com/captaincaius)
5.8.1 / 2019-12-12
==================
* fix(documentarray): dont attempt to cast when modifying array returned from map() #8399
* fix(document): update single nested subdoc parent when setting to existing single nested doc #8400
* fix(schema): add `$embeddedSchemaType` property to arrays for consistency with document arrays #8389
5.8.0 / 2019-12-09
==================
* feat: wrap server selection timeout errors in `MongooseTimeoutError` to retain original stack trace #8259
* feat(model): add `Model.validate()` function that validates a POJO against the model's schema #7587
* feat(schema): add `Schema#pick()` function to create a new schema with a picked subset of the original schema's paths #8207
* feat(schema): add ability to change CastError message using `cast` option to SchemaType #8300
* feat(schema): group indexes defined in schema path with the same name #6499
* fix(model): build all indexes even if one index fails #8185 [unusualbob](https://github.com/unusualbob)
* feat(browser): pre-compile mongoose/browser #8350 [captaincaius](https://github.com/captaincaius)
* fix(connection): throw error when setting unsupported option #8335 #6899 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(schema): support `enum` validator for number type #8139
* feat(update): allow using MongoDB 4.2 update aggregation pipelines, with no Mongoose casting #8225
* fix(update): make update validators run on all subpaths when setting a nested path, even omitted subpaths #3587
* feat(schema): support setting `_id` as an option to single nested schema paths #8137
* feat(query): add Query#mongooseOptions() function #8296
* feat(array): make `MongooseArray#push()` support using `$position` #4322
* feat(schema): make pojo paths optionally become subdoc instead of Mixed #8228 [captaincaius](https://github.com/captaincaius)
* feat(model): add Model.cleanIndexes() to drop non-schema indexes #6676
* feat(document): make `updateOne()` document middleware pass `this` to post hooks #8262
* feat(aggregate): run pre/post aggregate hooks on `explain()` #5887
* docs(model+query): add `session` option to docs for findOneAndX() methods #8396
5.7.14 / 2019-12-06
===================
* fix(cursor): wait until all `eachAsync()` functions finish before resolving the promise #8352
* fix(update): handle embedded discriminator paths when discriminator key is defined in the update #8378
* fix(schematype): handle passing `message` function to `SchemaType#validate()` as positional arg #8360
* fix(map): handle cloning a schema that has a map of subdocuments #8357
* docs(schema): clarify that `uppercase`, `lowercase`, and `trim` options for SchemaString don't affect RegExp queries #8333
5.7.13 / 2019-11-29
===================
* fix: upgrade mongodb driver -> 3.3.5 #8383
* fix(model): catch the error when insertMany fails to initialize the document #8365 #8363 [Fonger](https://github.com/Fonger)
* fix(schema): add array.$, array.$.$ subpaths for nested arrays #6405
* docs(error): add more detail about the ValidatorError class, including properties #8346
* docs(connection): document `Connection#models` property #8314
5.7.12 / 2019-11-19
===================
* fix: avoid throwing error if calling `push()` on a doc array with no parent #8351 #8317 #8312 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(connection): only buffer for "open" events when calling connection helper while connecting #8319
* fix(connection): pull default database from connection string if specified #8355 #8354 [zachazar](https://github.com/zachazar)
* fix(populate+discriminator): handle populating document whose discriminator value is different from discriminator model name #8324
* fix: add `mongoose.isValidObjectId()` function to test whether Mongoose can cast a value to an objectid #3823
* fix(model): support setting `excludeIndexes` as schema option for subdocs #8343
* fix: add SchemaMapOptions class for options to map schematype #8318
* docs(query): remove duplicate omitUndefined options #8349 [mdumandag](https://github.com/mdumandag)
* docs(schema): add Schema#paths docs to public API docs #8340
5.7.11 / 2019-11-14
===================
* fix: update mongodb driver -> 3.3.4 #8276
* fix(model): throw readable error when casting bulkWrite update without a 'filter' or 'update' #8332 #8331 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(connection): bubble up connected/disconnected events with unified topology #8338 #8337
* fix(model): delete $versionError after saving #8326 #8048 [Fonger](https://github.com/Fonger)
* test(model): add test for issue #8040 #8341 [Fonger](https://github.com/Fonger)
5.7.10 / 2019-11-11
===================
* perf(cursor): remove unnecessary `setTimeout()` in `eachAsync()`, 4x speedup in basic benchmarks #8310
* docs(README): re-order sections for better readability #8321 [dandv](https://github.com/dandv)
* chore: make npm test not hard-code file paths #8322 [stieg](https://github.com/stieg)
5.7.9 / 2019-11-08
==================
* fix(schema): support setting schema path to an instance of SchemaTypeOptions to fix integration with mongoose-i18n-localize #8297 #8292
* fix(populate): make `retainNullValues` set array element to `null` if foreign doc with that id was not found #8293
* fix(document): support getter setting virtual on manually populated doc when calling toJSON() #8295
* fix(model): allow objects with `toBSON()` to make it to `save()` #8299
5.7.8 / 2019-11-04
==================
* fix(document): allow manually populating path within document array #8273
* fix(populate): update top-level `populated()` when updating document array with populated subpaths #8265
* fix(cursor): throw error when using aggregation cursor as async iterator #8280
* fix(schema): retain `_id: false` in schema after nesting in another schema #8274
* fix(document): make Document class an event emitter to support defining documents without models in node #8272
* docs: document return types for `.discriminator()` #8287
* docs(connection): add note about exporting schemas, not models, in multi connection paradigm #8275
* docs: clarify that transforms defined in `toObject()` options are applied to subdocs #8260
5.7.7 / 2019-10-24
==================
* fix(populate): make populate virtual consistently an empty array if local field is only empty arrays #8230
* fix(query): allow findOne(objectid) and find(objectid) #8268
5.7.6 / 2019-10-21
==================
* fix: upgrade mongodb driver -> 3.3.3 to fix issue with failing to connect to a replica set if one member is down #8209
* fix(document): fix TypeError when setting a single nested subdoc with timestamps #8251
* fix(cursor): fix issue with long-running `eachAsync()` cursor #8249 #8235
* fix(connection): ensure repeated `close` events from useUnifiedTopology don't disconnect Mongoose from replica set #8224
* fix(document): support calling `Document` constructor directly in Node.js #8237
* fix(populate): add document array subpaths to parent doc `populated()` when calling `DocumentArray#push()` #8247
* fix(options): add missing minlength and maxlength to SchemaStringOptions #8256
* docs: add documentarraypath to API docs, including DocumentArrayPath#discriminator() #8164
* docs(schematypes): add a section about the `type` property #8227
* docs(api): fix Connection.close return param #8258 [gosuhiman](https://github.com/gosuhiman)
* docs: update link to broken image on home page #8253 [krosenk729](https://github.com/krosenk729)
5.7.5 / 2019-10-14
==================
* fix(query): delete top-level `_bsontype` property in queries to prevent silent empty queries #8222
* fix(update): handle subdocument pre('validate') errors in update validation #7187
* fix(subdocument): make subdocument#isModified use parent document's isModified #8223
* docs(index): add favicon to home page #8226
* docs: add schema options to API docs #8012
* docs(middleware): add note about accessing the document being updated in pre('findOneAndUpdate') #8218
* refactor: remove redundant code in ValidationError #8244 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
5.7.4 / 2019-10-09
==================
* fix(schema): handle `required: null` and `required: undefined` as `required: false` #8219
* fix(update): support updating array embedded discriminator props if discriminator key in $elemMatch #8063
* fix(populate): allow accessing populate virtual prop underneath array when virtual defined on top level #8198
* fix(model): support passing `options` to `Model.remove()` #8211
* fix(document): handle `Document#set()` merge option when setting underneath single nested schema #8201
* fix: use options constructor class for all schematypes #8012
5.7.3 / 2019-09-30
==================
* fix: make CoreMongooseArray#includes() handle `fromIndex` parameter #8203
* fix(update): cast right hand side of `$pull` as a query instead of an update for document arrays #8166
* fix(populate): handle virtual populate of an embedded discriminator nested path #8173
* docs(validation): remove deprecated `isAsync` from validation docs in favor of emphasizing promises #8184
* docs(documents): add overwriting section #8178
* docs(promises): add note about queries being thenable #8110
* perf: avoid update validators going into Mixed types #8192 [birdofpreyru](https://github.com/birdofpreyru)
* refactor: remove async as a prod dependency #8073
5.7.2 / 2019-09-23
==================
* fix(mongoose): support `mongoose.set('autoIndex', false)` #8158
* fix(discriminator): support `tiedValue` parameter for embedded discriminators analagous to top-level discriminators #8164
* fix(query): handle `toConstructor()` with entries-style sort syntax #8159
* fix(populate): avoid converting mixed paths into arrays if populating an object path under `Mixed` #8157
* fix: use $wrapCallback when using promises for mongoose-async-hooks
* fix: handle queries with setter that converts value to Number instance #8150
* docs: add mongoosejs-cli to readme #8142
* docs: fix example typo for Schema.prototype.plugin() #8175 [anaethoss](https://github.com/anaethoss)
5.7.1 / 2019-09-13
==================
* fix(query): fix TypeError when calling `findOneAndUpdate()` with `runValidators` #8151 [fernandolguevara](https://github.com/fernandolguevara)
* fix(document): throw strict mode error if setting an immutable path with strict mode: false #8149
* fix(mongoose): support passing options object to Mongoose constructor #8144
* fix(model): make syncIndexes() handle changes in index key order #8135
* fix(error): export StrictModeError as a static property of MongooseError #8148 [ouyuran](https://github.com/ouyuran)
* docs(connection+mongoose): add `useUnifiedTopology` option to `connect()` and `openUri()` docs #8146
5.7.0 / 2019-09-09
==================
* feat(document+query): support conditionally immutable schema paths #8001
* perf(documentarray): refactor to use ES6 classes instead of mixins, ~30% speedup #7895
* feat: use MongoDB driver 3.3.x for MongoDB 4.2 support #8083 #8078
* feat(schema+query): add pre('validate') and post('validate') hooks for update validation #7984
* fix(timestamps): ensure updatedAt gets incremented consistently using update with and without $set #4768
* feat(query): add `Query#get()` to make writing custom setters that handle both queries and documents easier #7312
* feat(document): run setters on defaults #8012
* feat(document): add `aliases: false` option to `Document#toObject()` #7548
* feat(timestamps): support skipping updatedAt and createdAt for individual save() and update() #3934
* docs: fix index creation link in guide #8138 [joebowbeer](https://github.com/joebowbeer)
5.6.13 / 2019-09-04
===================
* fix(parallel): fix parallelLimit when fns is empty #8130 #8128 [sibelius](https://github.com/sibelius)
* fix(document): ensure nested mixed validator gets called exactly once #8117
* fix(populate): handle `justOne = undefined` #8125 [taxilian](https://github.com/taxilian)
5.6.12 / 2019-09-03
===================
* fix(schema): handle required validator correctly with `clone()` #8111
* fix(schema): copy schematype getters and setters when cloning #8124 [StphnDamon](https://github.com/StphnDamon)
* fix(discriminator): avoid unnecessarily cloning schema to avoid leaking memory on repeated `discriminator()` calls #2874
* docs(schematypes): clarify when Mongoose uses `toString()` to convert an object to a string #8112 [TheTrueRandom](https://github.com/TheTrueRandom)
* docs(plugins): fix out of date link to npm docs #8100
* docs(deprecations): fix typo #8109 [jgcmarins](https://github.com/jgcmarins)
* refactor(model): remove dependency on `async.parallelLimit()` for `insertMany()` #8073
5.6.11 / 2019-08-25
===================
* fix(model): allow passing options to `exists()` #8075
* fix(document): make `validateUpdatedOnly` option handle pre-existing errors #8091
* fix: throw readable error if middleware callback isnt a function #8087
* fix: don't throw error if calling `find()` on a nested array #8089
* docs(middleware): clarify that you must add middleware before compiling your model #5087
* docs(query): add missing options to `setOptions()` #8099
5.6.10 / 2019-08-20
===================
* fix(schema): fix require() path to work around yet another bug in Jest #8053
* fix(document): skip casting when initing a populated path #8062
* fix(document): prevent double-calling validators on mixed objects with nested properties #8067
* fix(query): handle schematype with `null` options when checking immutability #8070 [rich-earth](https://github.com/rich-earth)
* fix(schema): support `Schema#path()` to get schema path underneath doc array #8057
* docs(faq): add disable color instruction #8066
5.6.9 / 2019-08-07
==================
* fix(model): delete versionError after saving to prevent memory leak #8048
* fix(cursor): correctly handle batchSize option with query cursor #8039
* fix(populate): handle virtual populate with count = 0 if virtual embedded in doc array #7573
* fix(schema): allow declaring ObjectId array with `{ type: 'ObjectID' }`, last 'D' case insensitive #8034
5.6.8 / 2019-08-02
==================
* fix(aggregate): allow modifying pipeline in pre('aggregate') hooks #8017
* fix(query): make `findOneAndReplace()` work with `orFail()` #8030
* fix(document): allow saving an unchanged document if required populated path is null #8018
* fix(debug): support disabling colors in debug mode #8033 [Mangosteen-Yang](https://github.com/Mangosteen-Yang)
* docs: add async-await guide #8028 [Rossh87](https://github.com/Rossh87)
* docs(plugins): rewrite plugins docs to be more modern and not use strange `= exports` syntax #8026
* docs(transactions): clarify relationship between `session` in docs and MongoDB driver ClientSession class, link to driver docs #8009
5.6.7 / 2019-07-26
==================
* fix(document): support validators on nested arrays #7926
* fix(timestamps): handle `timestamps: false` in child schema #8007
* fix(query): consistently support `new` option to `findOneAndX()` as an alternative to `returnOriginal` #7846
* fix(document): make `inspect()` never return `null`, because a document or nested path is never `== null` #7942
* docs(query+lean): add links to mongoose-lean-virtuals, mongoose-lean-getters, mongoose-lean-defaults #5606
* docs: add example for `Schema#pre(Array)` #8022 [Mangosteen-Yang](https://github.com/Mangosteen-Yang)
* docs(schematype): updated comment from Schema.path to proper s.path #8013 [chrisweilacker](https://github.com/chrisweilacker)
* chore: upgrade nyc #8015 [kolya182](https://github.com/kolya182)
5.6.6 / 2019-07-22
==================
* fix(populate): handle refPath returning a virtual with `Query#populate()` #7341
* fix(populate): handle `refPath` in discriminator when populating top-level model #5109
* fix(mongoose): ensure destucturing and named imports work for Mongoose singleton methods like `set()`, etc. #6039
* fix(query): add missing options for deleteOne and deleteMany in Query #8004 [Fonger](https://github.com/Fonger)
* fix(schema): make embedded discriminators `instanceof` their parent types #5005
* fix(array): make `validators` a private property that doesn't show up in for/in #6572
* docs(api): fix array API docs that vanished because of #7798 #7979
* docs(discriminators+api): add single nested discriminator to discriminator docs and API docs #7983
* docs(connection+mongoose): make option lists consistent between `mongoose.connect()`, `mongoose.createConnection()`, and `conn.openUri()` #7976
* docs(validation): clarify resolve(false) vs reject() for promise-based async custom validators #7761
* docs(guide): use correct `mongoose.set()` instead of `mongoose.use()` #7998
* docs: add redis cache example #7997 [usama-asfar](https://github.com/usama-asfar)
5.6.5 / 2019-07-17
==================
* fix(document): handle setting non-schema path to ObjectId or Decimal128 if strict: false #7973
* fix(connection): remove backwards-breaking multiple mongoose.connect() call for now #7977
* fix(schema): print invalid value in error message when a schema path is set to undefined or null #7956
* fix(model): throw readable error if calling `new Model.discriminator()` #7957
* fix(mongoose): export `cast()` function #7975 [perfectstorm88](https://github.com/perfectstorm88)
* docs(model): fix link to Model.inspect() and add example #7990
* docs: fix broken anchor links on validation tutorial #7966
* docs(api): fix broken links to split API pages #7978
* chore: create LICENSE.md #7989 [Fonger](https://github.com/Fonger)
5.6.4 / 2019-07-08
==================
* fix(schema): support pre(Array, Function) and post(Array, Function) #7803
* fix(document): load docs with a `once` property successfully #7958
* fix(queryhelpers): ensure parent `select` overwrites child path `select` if parent is nested #7945
* fix(schema): make `clone()` correctly copy array embedded discriminators #7954
* fix(update): fix error when update property gets casted to null #7949
* fix(connection): bubble up attemptReconnect event for now #7872
* docs(tutorials): add virtuals tutorial #7965
* docs(connection): add section on connection handling #6997
5.6.3 / 2019-07-03
==================
* fix(document): respect projection when running getters #7940
* fix(model): call createCollection() in syncIndexes() to ensure the collection exists #7931
* fix(document): consistently use post-order traversal for gathering subdocs for hooks #7929
* fix(schema): ensure `Schema#pathType()` returns correct path type given non-existent positional path #7935
* fix(ChangeStream): set `closed` if emitting close event #7930
* fix(connection): bubble up 'attemptReconnect' event from MongoDB connection #7872
* docs: fix broken .jade links on search page #7932
* docs: correct link to `Query#select()` #7953 [rayhatfield](https://github.com/rayhatfield)
* docs(README): add list of related projects #7773
4.13.19 / 2019-07-02
====================
* fix(aggregate): make `setOptions()` work as advertised #7950 #6011 [cdimitroulas](https://github.com/cdimitroulas)
5.6.2 / 2019-06-28
==================
* fix(update): allow using `update()` with immutable `createdAt` #7917
* fix(model): pass `doc` parameter to save() error handling middleware #7832
* fix(mongoose): add applyPluginsToChildSchemas option to allow opting out of global plugins for child schemas #7916
* docs(connection): document `useCache` option for `useDb()` #7923
* docs: fix broken link in FAQ #7925 [christophergeiger3](https://github.com/christophergeiger3)
5.6.1 / 2019-06-24
==================
* fix(update): skip setting defaults for single embedded subdocs underneath maps #7909
* fix(document): copy date objects correctly when strict = false #7907
* feat(mongoose): throw an error if calling `mongoose.connect()` multiple times while connected #7905 [Fonger](https://github.com/Fonger)
* fix(document): copies virtuals from array subdocs when casting array of docs with same schema #7898
* fix(schema): ensure clone() copies single embedded discriminators correctly #7894
* fix(discriminator): merge instead of overwriting conflicting nested schemas in discriminator schema #7884
* fix(populate): ignore nullish arguments when calling `populate()` #7913 [rayhatfield](https://github.com/rayhatfield)
* docs: add getters/setters tutorial #7919
* docs: clean up error docs so they refer to `Error` rather than `MongooseError` #7867
* docs: fix a couple broken links #7921 [kizmo04](https://github.com/kizmo04)
* refactor: remove unnecessary if #7911 [rayhatfield](https://github.com/rayhatfield)
5.6.0 / 2019-06-14
==================
* feat(schematype): add `immutable` option to disallow changing a given field #7671
* docs: split API docs into separate pages to make API documentation more Google-able #7812
* perf(array): remove all mixins in favor of ES6 classes, ~20% faster in basic benchmarks #7798
* feat(document): use promise rejection error message when async custom validator throws an error #4913
* feat(virtual): pass document as 3rd parameter to virtual getters and setters to enable using arrow functions #4143
* feat(model): add `Model.exists()` function to quickly check whether a document matching `filter` exists #6872
* feat(index+connection): support setting global and connection-level `maxTimeMS`
* feat(populate): support setting `ref` to a function for conventional populate #7669
* feat(document): add overwrite() function that overwrites all values in a document #7830
* feat(populate): support `PopulateOptions#connection` option to allow cross-db populate with refPath #6520
* feat(populate): add skipInvalidIds option to silently skip population if id is invalid, instead of throwing #7706
* feat(array): skip empty array default if there's a 2dsphere index on a geojson path #3233
* feat(query): add `getFilter()` as an alias of `getQuery()` to be more in line with API docs #7839
* feat(model): add Model.inspect() to make models not clutter `util.inspect()` #7836
* perf(discriminator): skip calling `createIndex()` on indexes that are defined in the base schema #7379
* docs: upgrade from Jade to latest Pug #7812
* docs(README): update reference to example schema.js #7899 [sharils](https://github.com/sharils)
* docs(README): improve variable name #7900 [sharils](https://github.com/sharils)
* chore: replace charAt(0) with startsWith #7897 [Fonger](https://github.com/Fonger)
* chore: replace indexOf with includes, startsWith and endsWith for String #7897 [Fonger](https://github.com/Fonger)
5.5.15 / 2019-06-12
===================
* fix(connection): reject initial connect promise even if there is an on('error') listener #7850
* fix(map): make `of` automatically convert POJOs to schemas unless typeKey is set #7859
* fix(update): use discriminator schema to cast update if discriminator key specified in filter #7843
* fix(array): copy atomics from source array #7891 #7889 [jyrkive](https://github.com/jyrkive)
* fix(schema): return this when Schema.prototype.add is called with Schema #7887 [Mickael-van-der-Beek](https://github.com/Mickael-van-der-Beek)
* fix(document): add `numAffected` and `result` to DocumentNotFoundError for better debugging #7892 #7844
5.5.14 / 2019-06-08
===================
* fix(query): correct this scope of setters in update query #7876 [Fonger](https://github.com/Fonger)
* fix(model): reset modifiedPaths after successful insertMany #7852 #7873 [Fonger](https://github.com/Fonger)
* fix(populate): allow using `refPath` with virtual populate #7848
* fix(document): prepend private methods getValue and setValue with $ #7870 [Fonger](https://github.com/Fonger)
* fix: update mongodb driver -> 3.2.7 #7871 [Fonger](https://github.com/Fonger)
* docs(tutorials): add tutorial about custom casting functions #7045
* docs(connection): fix outdated events document #7874 [Fonger](https://github.com/Fonger)
* docs: fix typo in lean docs #7875 [tannakartikey](https://github.com/tannakartikey)
* docs: move off of KeenIO for tracking and use self-hosted analytics instead
5.5.13 / 2019-06-05
===================
* fix(model): support passing deleteOne options #7860 #7857 [Fonger](https://github.com/Fonger)
* fix(update): run setters on array elements when doing $addToSet, $push, etc #4185
* fix(model): support getting discriminator by value when creating a new model #7851
* docs(transactions): add section about the `withTransaction()` helper #7598
* docs(schema): clarify relationship between Schema#static() and Schema#statics #7827
* docs(model): fix typo `projetion` to `projection` #7868 [dfdeagle47](https://github.com/dfdeagle47)
* docs(schema): correct schema options lists #7828
5.5.12 / 2019-05-31
===================
* fix(document): fix unexpected error when loading a document with a nested property named `schema` #7831
* fix(model): skip applying static hooks by default if static name conflicts with query middleware (re: mongoose-delete plugin) #7790
* fix(query): apply schema-level projections to the result of `findOneAndReplace()` #7654
* fix: upgrade mongodb driver -> 3.2.6
* docs(tutorials): add findOneAndUpdate() tutorial #7847
* docs(validation): add `updateOne()` and `updateMany()` to list of update validator operations #7845
* docs(model): make sure options lists in `update()` API line up #7842
5.5.11 / 2019-05-23
===================
* fix(discriminator): allow numeric discriminator keys for embedded discriminators #7808
* chore: add Node.js 12 to travis build matrix #7784
5.5.10 / 2019-05-20
===================