Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Automattic/mongoose
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5449ab9e51a779a889b3751416bab1480630b037
Choose a base ref
...
head repository: Automattic/mongoose
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 71478c4ff64a8afa6007c9d246e4403f701ed48a
Choose a head ref

Commits on Jun 25, 2022

  1. Copy the full SHA
    4a2e65e View commit details
  2. Copy the full SHA
    1ccbed6 View commit details

Commits on Jun 26, 2022

  1. Copy the full SHA
    989525c View commit details
  2. perf(document+internal): put default value for $isNew and `strictMo…

    …de` on prototype to avoid unnecessary memory usage
    
    Re: #11541
    vkarpov15 committed Jun 26, 2022
    Copy the full SHA
    9e05baf View commit details
  3. perf(schema): correctly pull DocumentArrayPath default _id value wh…

    …en creating document array with schema re: #11541
    vkarpov15 committed Jun 26, 2022
    Copy the full SHA
    3a1c821 View commit details

Commits on Jul 6, 2022

  1. feat(model): add applyDefaults() helper that allows applying defaul…

    …ts to document or POJO
    
    Re: #11945
    vkarpov15 committed Jul 6, 2022
    Copy the full SHA
    ae73d8b View commit details
  2. Copy the full SHA
    dd49bc1 View commit details

Commits on Jul 7, 2022

  1. added global id option

    IslandRhythms committed Jul 7, 2022
    Copy the full SHA
    08f1179 View commit details
  2. typo fix

    IslandRhythms committed Jul 7, 2022
    Copy the full SHA
    97a63a4 View commit details

Commits on Jul 8, 2022

  1. Copy the full SHA
    ed5879e View commit details
  2. Copy the full SHA
    6522059 View commit details
  3. Update query.js

    IslandRhythms committed Jul 8, 2022
    Copy the full SHA
    823aad0 View commit details
  4. removed logs

    IslandRhythms committed Jul 8, 2022
    Copy the full SHA
    a1baf67 View commit details
  5. Copy the full SHA
    3e159b6 View commit details
  6. Copy the full SHA
    a0b5ba4 View commit details
  7. Copy the full SHA
    0e813b8 View commit details
  8. Copy the full SHA
    f2d37c2 View commit details
  9. enable failing test

    AbdelrahmanHafez committed Jul 8, 2022
    Copy the full SHA
    1cbe028 View commit details
  10. Copy the full SHA
    399668a View commit details
  11. Copy the full SHA
    f6fd921 View commit details
  12. Copy the full SHA
    056b2e4 View commit details
  13. Copy the full SHA
    b855d5c View commit details

Commits on Jul 11, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    hasezoey hasezoey
    Copy the full SHA
    966abe0 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3379c3e View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    hasezoey hasezoey
    Copy the full SHA
    b4715b5 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    hasezoey hasezoey
    Copy the full SHA
    80c102b View commit details

Commits on Jul 12, 2022

  1. fix: apply suggestion

    Co-authored-by: Hafez <a.hafez852@gmail.com>
    hasezoey and AbdelrahmanHafez authored Jul 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c08b8c4 View commit details
  2. test: update tests for suggestion

    this updates the test so that "castNonArrays" (property option) overwrites global
    hasezoey committed Jul 12, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    hasezoey hasezoey
    Copy the full SHA
    765e66b View commit details

Commits on Jul 15, 2022

  1. Merge pull request #12090 from hasezoey/castNonArrays

    feat(array): add property option "castNonArrays"
    vkarpov15 authored Jul 15, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d97938b View commit details
  2. Update lib/query.js

    Co-authored-by: Hafez <a.hafez852@gmail.com>
    vkarpov15 and AbdelrahmanHafez authored Jul 15, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d0d0243 View commit details
  3. Copy the full SHA
    0a88950 View commit details
  4. Copy the full SHA
    0395195 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    52308e1 View commit details
  6. Copy the full SHA
    486934f View commit details
  7. Copy the full SHA
    f6a3568 View commit details
  8. Copy the full SHA
    91bd1ab View commit details

Commits on Jul 16, 2022

  1. Merge pull request #12082 from Automattic/gh-12059

    feat(model): allow passing `timestamps` option to `Model.bulkSave(...)`
    vkarpov15 authored Jul 16, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7187253 View commit details

Commits on Jul 18, 2022

  1. Copy the full SHA
    f4c436a View commit details
  2. Copy the full SHA
    130337d View commit details
  3. Copy the full SHA
    8f4cc45 View commit details
  4. Copy the full SHA
    fa29f3a View commit details
  5. Merge pull request #11988 from Automattic/vkarpov15/gh-11541

    perf(document): avoid creating unnecessary empty objects when creating a state machine
    vkarpov15 authored Jul 18, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    871a121 View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e62d0ff View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b165936 View commit details
  8. Merge pull request #12057 from Automattic/vkarpov15/gh-11945

    feat(model): add `applyDefaults()` helper that allows applying defaults to document or POJO
    vkarpov15 authored Jul 18, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1ff55dd View commit details
  9. Copy the full SHA
    9117ff9 View commit details
  10. Copy the full SHA
    34e00fb View commit details
  11. Copy the full SHA
    491521e View commit details
  12. Update test/document.test.js

    Co-authored-by: Hafez <a.hafez852@gmail.com>
    vkarpov15 and AbdelrahmanHafez authored Jul 18, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    00cf1c7 View commit details
  13. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7280d25 View commit details
Showing with 5,635 additions and 3,242 deletions.
  1. +0 −2 .github/dependabot.yml
  2. +10 −3 .github/workflows/benchmark.yml
  3. +30 −43 .github/workflows/test.yml
  4. +2 −1 .github/workflows/tidelift-alignment.yml
  5. +4 −0 .gitignore
  6. +2 −0 .mocharc.yml
  7. +118 −0 CHANGELOG.md
  8. +0 −132 benchmarks/typescript.js
  9. +1 −0 benchmarks/typescript/simple/.npmrc
  10. +1 −1 benchmarks/typescript/simple/index.ts
  11. +6 −0 benchmarks/typescript/simple/package.json
  12. +1 −12 benchmarks/typescript/simple/tsconfig.json
  13. +1 −27 docs/api.pug
  14. +15 −16 docs/api_split.pug
  15. +26 −12 docs/compatibility.md
  16. +1 −1 docs/connections.md
  17. +13 −1 docs/css/api.css
  18. +0 −1 docs/css/style.css
  19. +4 −4 docs/deprecations.md
  20. +4 −4 docs/documents.md
  21. +18 −18 docs/enterprise.md
  22. +43 −45 docs/further_reading.md
  23. +1 −5 docs/geojson.md
  24. +50 −12 docs/guide.md
  25. +1 −0 docs/guides.md
  26. +0 −9 docs/helpers/href.js
  27. +0 −6 docs/helpers/klass.js
  28. +0 −53 docs/helpers/linktype.js
  29. +0 −11 docs/includes/googlesearch.pug
  30. +0 −1 docs/includes/track.pug
  31. +2 −0 docs/index.md
  32. +40 −0 docs/js/api-bold-current-nav.js
  33. +46 −0 docs/js/mobile-navbar-toggle.js
  34. +2 −2 docs/js/navbar-search.js
  35. +1 −47 docs/layout.pug
  36. +4 −3 docs/loadSponsorData.js
  37. +18 −12 docs/middleware.md
  38. +2 −2 docs/migrating_to_5.md
  39. +24 −18 docs/migrating_to_6.md
  40. +4 −4 docs/models.md
  41. +4 −4 docs/populate.md
  42. +17 −17 docs/queries.md
  43. +4 −11 docs/schematypes.md
  44. +87 −3 docs/source/api.js
  45. +1 −1 docs/source/index.js
  46. +3 −3 docs/splitApiDocs.js
  47. +1 −1 docs/subdocs.md
  48. +2 −2 docs/tutorials/lean.md
  49. +2 −2 docs/tutorials/query_casting.md
  50. +1 −1 docs/typescript/schemas.md
  51. +28 −0 docs/typescript/virtuals.md
  52. +0 −8 examples/ecommerce-netlify-functions/.config/development.js
  53. +0 −13 examples/ecommerce-netlify-functions/.config/index.js
  54. +0 −9 examples/ecommerce-netlify-functions/.config/test.js
  55. +0 −1 examples/ecommerce-netlify-functions/.netlify/edge-functions-import-map.json
  56. +0 −54 examples/ecommerce-netlify-functions/README.md
  57. +0 −15 examples/ecommerce-netlify-functions/connect.js
  58. +0 −5 examples/ecommerce-netlify-functions/integrations/stripe.js
  59. +0 −84 examples/ecommerce-netlify-functions/models.js
  60. +0 −48 examples/ecommerce-netlify-functions/netlify/functions/addToCart.js
  61. +0 −69 examples/ecommerce-netlify-functions/netlify/functions/checkout.js
  62. +0 −19 examples/ecommerce-netlify-functions/netlify/functions/getCart.js
  63. +0 −16 examples/ecommerce-netlify-functions/netlify/functions/getProducts.js
  64. +0 −34 examples/ecommerce-netlify-functions/netlify/functions/removeFromCart.js
  65. +0 −16 examples/ecommerce-netlify-functions/package.json
  66. +0 −39 examples/ecommerce-netlify-functions/seed.js
  67. +0 −79 examples/ecommerce-netlify-functions/test/addToCart.test.js
  68. +0 −52 examples/ecommerce-netlify-functions/test/checkout.test.js
  69. +0 −7 examples/ecommerce-netlify-functions/test/fixtures/createCart.js
  70. +0 −7 examples/ecommerce-netlify-functions/test/fixtures/createOrder.js
  71. +0 −7 examples/ecommerce-netlify-functions/test/fixtures/createProducts.js
  72. +0 −11 examples/ecommerce-netlify-functions/test/fixtures/index.js
  73. +0 −20 examples/ecommerce-netlify-functions/test/getCart.test.js
  74. +0 −20 examples/ecommerce-netlify-functions/test/getProducts.test.js
  75. +0 −77 examples/ecommerce-netlify-functions/test/removeFromCart.test.js
  76. +0 −14 examples/ecommerce-netlify-functions/test/setup.test.js
  77. +1 −1 examples/mapreduce/mapreduce.js
  78. +4 −4 examples/redis-todo/routers/todoRouter.js
  79. +2 −2 examples/redis-todo/routers/userRouter.js
  80. +51 −1 index.js
  81. +3 −5 index.pug
  82. +65 −39 lib/aggregate.js
  83. +1 −1 lib/browser.js
  84. +1 −1 lib/browserDocument.js
  85. +5 −2 lib/cast.js
  86. +1 −1 lib/cast/boolean.js
  87. +1 −1 lib/cast/number.js
  88. +1 −1 lib/cast/string.js
  89. +1 −1 lib/collection.js
  90. +77 −31 lib/connection.js
  91. +17 −6 lib/cursor/AggregationCursor.js
  92. +39 −1 lib/cursor/ChangeStream.js
  93. +16 −5 lib/cursor/QueryCursor.js
  94. +332 −271 lib/document.js
  95. +2 −1 lib/drivers/browser/objectid.js
  96. +1 −1 lib/drivers/node-mongodb-native/ReadPreference.js
  97. +7 −3 lib/drivers/node-mongodb-native/collection.js
  98. +1 −1 lib/drivers/node-mongodb-native/connection.js
  99. +1 −1 lib/error/browserMissingSchema.js
  100. +2 −1 lib/error/cast.js
  101. +2 −1 lib/error/divergentArray.js
  102. +1 −0 lib/error/index.js
  103. +2 −1 lib/error/missingSchema.js
  104. +2 −1 lib/error/notFound.js
  105. +2 −1 lib/error/overwriteModel.js
  106. +29 −0 lib/error/strictPopulate.js
  107. +18 −7 lib/error/validation.js
  108. +8 −4 lib/error/validator.js
  109. +1 −1 lib/helpers/clone.js
  110. +17 −1 lib/helpers/cursor/eachAsync.js
  111. +2 −1 lib/helpers/discriminator/getConstructor.js
  112. +7 −6 lib/helpers/discriminator/getDiscriminatorByValue.js
  113. +7 −6 lib/helpers/discriminator/getSchemaDiscriminatorByValue.js
  114. +115 −0 lib/helpers/document/applyDefaults.js
  115. +3 −3 lib/helpers/document/cleanModifiedSubpaths.js
  116. +21 −8 lib/helpers/document/compile.js
  117. +5 −1 lib/helpers/document/getEmbeddedDiscriminatorPath.js
  118. +8 −0 lib/helpers/firstKey.js
  119. +2 −1 lib/helpers/get.js
  120. +2 −1 lib/helpers/getConstructorName.js
  121. +6 −6 lib/helpers/indexes/isIndexEqual.js
  122. +2 −1 lib/helpers/isBsonType.js
  123. +2 −2 lib/helpers/isMongooseObject.js
  124. +1 −1 lib/helpers/isObject.js
  125. +1 −1 lib/helpers/isSimpleValidator.js
  126. +52 −0 lib/helpers/model/applyDefaultsToPOJO.js
  127. +11 −0 lib/helpers/model/applyHooks.js
  128. +11 −1 lib/helpers/model/applyMethods.js
  129. +2 −1 lib/helpers/model/applyStatics.js
  130. +8 −3 lib/helpers/model/castBulkWrite.js
  131. +3 −1 lib/helpers/model/discriminator.js
  132. +15 −0 lib/helpers/model/pushNestedArrayPaths.js
  133. +3 −2 lib/helpers/path/flattenObjectWithDottedPaths.js
  134. +1 −1 lib/helpers/pluralize.js
  135. +5 −3 lib/helpers/populate/assignRawDocsToIdStructure.js
  136. +14 −3 lib/helpers/populate/assignVals.js
  137. +8 −2 lib/helpers/populate/createPopulateQueryFilter.js
  138. +5 −4 lib/helpers/populate/getModelsMapForPopulate.js
  139. +3 −1 lib/helpers/populate/getSchemaTypes.js
  140. +6 −1 lib/helpers/populate/markArraySubdocsPopulated.js
  141. +5 −1 lib/helpers/projection/hasIncludedChildren.js
  142. +3 −2 lib/helpers/projection/isPathExcluded.js
  143. +2 −1 lib/helpers/projection/isSubpath.js
  144. +24 −15 lib/helpers/promiseOrCallback.js
  145. +3 −2 lib/helpers/query/applyQueryMiddleware.js
  146. +2 −2 lib/helpers/query/cast$expr.js
  147. +14 −8 lib/helpers/query/castUpdate.js
  148. +3 −2 lib/helpers/query/completeMany.js
  149. +7 −1 lib/helpers/query/getEmbeddedDiscriminatorPath.js
  150. +3 −1 lib/helpers/query/wrapThunk.js
  151. +7 −2 lib/helpers/schema/getIndexes.js
  152. +4 −3 lib/helpers/schema/getPath.js
  153. +2 −1 lib/helpers/schema/idGetter.js
  154. +15 −0 lib/helpers/setDefaultsOnInsert.js
  155. +6 −2 lib/helpers/update/applyTimestampsToChildren.js
  156. +24 −14 lib/index.js
  157. +3 −1 lib/internal.js
  158. +481 −257 lib/model.js
  159. +19 −0 lib/options/SchemaArrayOptions.js
  160. +2 −0 lib/options/SchemaNumberOptions.js
  161. +1 −0 lib/options/SchemaObjectIdOptions.js
  162. +2 −2 lib/plugins/trackTransaction.js
  163. +201 −87 lib/query.js
  164. +4 −4 lib/queryhelpers.js
  165. +37 −9 lib/schema.js
  166. +14 −2 lib/schema/SubdocumentPath.js
  167. +4 −3 lib/schema/array.js
  168. +2 −1 lib/schema/date.js
  169. +18 −4 lib/schema/documentarray.js
  170. +2 −2 lib/schema/operators/helpers.js
  171. +1 −1 lib/schema/operators/text.js
  172. +4 −1 lib/schema/string.js
  173. +117 −86 lib/schematype.js
  174. +35 −20 lib/statemachine.js
  175. +13 −3 lib/types/ArraySubdocument.js
  176. +9 −5 lib/types/DocumentArray/methods/index.js
  177. +62 −7 lib/types/array/methods/index.js
  178. +23 −21 lib/types/buffer.js
  179. +5 −1 lib/types/map.js
  180. +2 −2 lib/types/objectid.js
  181. +30 −8 lib/types/subdocument.js
  182. +66 −31 lib/utils.js
  183. +1 −0 lib/validoptions.js
  184. +14 −16 lib/virtualtype.js
  185. +20 −20 package.json
  186. +1 −1 { → scripts}/build-browser.js
  187. +7 −0 scripts/create-tarball.js
  188. +24 −0 scripts/static.js
  189. +231 −0 scripts/website.js
  190. +0 −13 static.js
  191. +38 −25 test/aggregate.test.js
  192. +24 −19 test/common.js
  193. +102 −22 test/connection.test.js
  194. +3 −3 test/docs/lean.test.js
  195. +1 −1 test/document.isselected.test.js
  196. +1 −1 test/document.populate.test.js
  197. +314 −3 test/document.test.js
  198. +1 −1 test/document.unit.test.js
  199. +1 −1 test/gh-1408.test.js
  200. +34 −0 test/helpers/cursor.eachAsync.test.js
  201. +21 −0 test/helpers/setDefaultsOnInsert.test.js
  202. +28 −12 test/index.test.js
  203. +0 −2 test/mocha.opts
  204. +1 −1 test/model.aggregate.test.js
  205. +28 −2 test/model.discriminator.test.js
  206. +1 −6 test/model.indexes.test.js
  207. +1 −1 test/model.populate.setting.test.js
  208. +22 −16 test/model.populate.test.js
  209. +1 −1 test/model.querying.test.js
  210. +562 −253 test/model.test.js
  211. +4 −4 test/model.update.test.js
  212. +81 −25 test/query.test.js
  213. +2 −2 test/schema.select.test.js
  214. +53 −1 test/schema.test.js
  215. +78 −10 test/schema.validation.test.js
  216. +3 −1 test/shard.test.js
  217. +67 −5 test/timestamps.test.js
  218. +105 −0 test/types.array.test.js
  219. +2 −2 test/types.document.test.js
  220. +15 −1 test/types.documentarray.test.js
  221. +18 −0 test/types/PipelineStage.test.ts
  222. +32 −0 test/types/aggregate.test.ts
  223. +72 −3 test/types/connection.test.ts
  224. +30 −0 test/types/document.test.ts
  225. +23 −0 test/types/expressions.test.ts
  226. +150 −1 test/types/models.test.ts
  227. +84 −0 test/types/plugin.test.ts
  228. +17 −1 test/types/populate.test.ts
  229. +13 −0 test/types/queries.test.ts
  230. +40 −1 test/types/schema.test.ts
  231. +35 −1 test/types/virtuals.test.ts
  232. +2 −29 test/util.js
  233. +9 −4 types/aggregate.d.ts
  234. +11 −5 types/connection.d.ts
  235. +1 −1 types/cursor.d.ts
  236. +9 −2 types/document.d.ts
  237. +3 −2 types/expressions.d.ts
  238. +44 −55 types/index.d.ts
  239. +2 −2 types/indexes.d.ts
  240. +3 −20 types/inferschematype.d.ts
  241. +1 −1 types/middlewares.d.ts
  242. +72 −65 types/models.d.ts
  243. +6 −0 types/mongooseoptions.d.ts
  244. +14 −1 types/pipelinestage.d.ts
  245. +33 −16 types/query.d.ts
  246. +15 −4 types/schemaoptions.d.ts
  247. +19 −0 types/utility.d.ts
  248. +14 −0 types/virtuals.d.ts
  249. +0 −205 website.js
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ updates:
interval: "monthly"
open-pull-requests-limit: 100
target-branch: master
ignore:
- dependency-name: "dox"
- package-ecosystem: github-actions
directory: "/"
schedule:
13 changes: 10 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Benchmark
name: TypeScript Benchmark
on:
pull_request:
paths:
@@ -23,14 +23,21 @@ jobs:
name: Benchmark TypeScript Types
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16

- run: npm install

- run: npx ts-benchmark -p ./benchmarks/typescript/simple -f 17/100000 18 29 32 -b master -g --colors
- run: node ./scripts/create-tarball.js

- run: npm install
working-directory: benchmarks/typescript/simple

- run: npx ts-benchmark -p ./ -f 17/100000 18 29 32 -b master -g -t --colors
working-directory: benchmarks/typescript/simple
env:
DB_URL: ${{ secrets.DB_URL }}
73 changes: 30 additions & 43 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ on:
- 'lib/**'
- 'test/**.js'
push:
branches:
- master
paths:
- '.github/workflows/test.yml'
- 'package.json'
@@ -43,17 +41,24 @@ jobs:
matrix:
node: [12, 14, 16, 18]
os: [ubuntu-18.04, ubuntu-20.04]
mongodb: [4.0.2, 5.0.2, 6.0.0]
include:
- os: ubuntu-18.04
mongo-os: ubuntu1804
mongo: 4.0.2
mongodb-os: ubuntu1804
- os: ubuntu-20.04
mongo-os: ubuntu2004
mongo: 5.0.2
mongodb-os: ubuntu2004
- os: ubuntu-20.04 # customize on which matrix the coverage will be collected on
mongodb: 5.0.2
node: 16
coverage: true
exclude:
- os: ubuntu-18.04
- os: ubuntu-18.04 # exclude because nodejs 18 requires higher GLIBC
node: 18
name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongo }}
- os: ubuntu-18.04 # exclude because there are no builds for this ubuntu-mongodb version combination
mongodb: 6.0.0
- os: ubuntu-20.04 # exclude because there are no <4.4 mongodb builds for 2004
mongodb: 4.0.2
name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongodb }} OS ${{ matrix.os }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

@@ -66,15 +71,26 @@ jobs:

- name: Setup
run: |
wget -q https://downloads.mongodb.org/linux/mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}.tgz
tar xf mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}.tgz
wget -q https://downloads.mongodb.org/linux/mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}.tgz
tar xf mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}.tgz
mkdir -p ./data/db/27017 ./data/db/27000
printf "\n--timeout 8000" >> ./test/mocha.opts
./mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}/bin/mongod --setParameter ttlMonitorSleepSecs=1 --fork --dbpath ./data/db/27017 --syslog --port 27017
printf "\ntimeout: 8000" >> ./.mocharc.yml
./mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}/bin/mongod --setParameter ttlMonitorSleepSecs=1 --fork --dbpath ./data/db/27017 --syslog --port 27017
sleep 2
mongod --version
echo `pwd`/mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}/bin >> $GITHUB_PATH
- run: npm test
echo `pwd`/mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}/bin >> $GITHUB_PATH
- name: NPM Test without Coverage
run: npm test
if: matrix.coverage != true
- name: NPM Test with Coverage
run: npm run test-coverage
if: matrix.coverage == true
- name: Archive code coverage results
uses: actions/upload-artifact@v3
if: matrix.coverage == true
with:
name: coverage
path: coverage

test-replica-sets:
needs:
@@ -91,35 +107,6 @@ jobs:
- name: Test
run: npm run test-rs

coverage:
needs:
- test-replica-sets
runs-on: ubuntu-20.04
name: Coverage
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup node
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16
- run: npm install
- name: Setup
run: |
wget -q https://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.2.tgz
tar xf mongodb-linux-x86_64-ubuntu2004-5.0.2.tgz
mkdir -p ./data/db/27017 ./data/db/27000
printf "\n--timeout 8000" >> ./test/mocha.opts
./mongodb-linux-x86_64-ubuntu2004-5.0.2/bin/mongod --setParameter ttlMonitorSleepSecs=1 --fork --dbpath ./data/db/27017 --syslog --port 27017
sleep 2
mongod --version
echo `pwd`/mongodb-linux-x86_64-ubuntu2004-5.0.2/bin >> $GITHUB_PATH
- name: test with coverage
run: npm run test-coverage
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage
dependency-review:
name: Dependency Review
if: github.event_name == 'pull_request'
3 changes: 2 additions & 1 deletion .github/workflows/tidelift-alignment.yml
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ jobs:
build:
name: Run Tidelift to ensure approved open source packages are in use
runs-on: ubuntu-latest
if: github.repository == 'Automattic/mongoose'
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
@@ -24,4 +25,4 @@ jobs:
env:
TIDELIFT_API_KEY: ${{ secrets.TIDELIFT_API_KEY }}
TIDELIFT_ORGANIZATION: ${{ secrets.TIDELIFT_ORGANIZATION }}
TIDELIFT_PROJECT: ${{ secrets.TIDELIFT_PROJECT }}
TIDELIFT_PROJECT: ${{ secrets.TIDELIFT_PROJECT }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -56,4 +56,8 @@ index.html
# yarn package-lock
yarn.lock

# npm pack output
mongoose.tgz
mongoose-*.tgz

examples/ecommerce-netlify-functions/.netlify/state.json
2 changes: 2 additions & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reporter: spec # better to identify failing / slow tests than "dot"
ui: bdd # explicitly setting, even though it is mocha default
118 changes: 118 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,121 @@
6.6.1 / 2022-09-14
==================
* fix: correctly apply defaults after subdoc init #12328
* fix(array): avoid using default _id when using pull() #12294
* fix: allow null values inside $expr objects #12429 [MartinDrost](https://github.com/MartinDrost)
* fix(query): use correct Query constructor when cloning query #12418
* docs(website): remove setting "latest38x" which is not used anywhere #12396 [hasezoey](https://github.com/hasezoey)

6.6.0 / 2022-09-08
==================
* feat: upgrade mongodb driver -> 4.9.1 #12370 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat: re-export default Mongoose instance properties for ESM named imports support #12256
* feat(model): add option to skip invalid fields with castObject() #12156 [IslandRhythms](https://github.com/IslandRhythms)
* feat: use setPrototypeOf() instead of __proto__ to allow running on Deno #12315
* feat(QueryCursor): add support for AbortSignal on eachAsync() #12323
* feat(types): add types for new $densify operator #12118 [IslandRhythms](https://github.com/IslandRhythms)

6.5.5 / 2022-09-07
==================
* fix(setDefaultsOnInsert): avoid applying defaults on insert if nested property set #12279
* fix(model): make applyHooks() and applyMethods() handle case where custom method is set to Mongoose implementation #12254
* fix(types): add string "ascending" and "descending" index-directions #10269
* docs: upgrade dox to 1.0.0 #12403 [hasezoey](https://github.com/hasezoey)
* docs: update old mongodb nodejs driver documentation urls #12387 [hasezoey](https://github.com/hasezoey)
* docs: update JSDOC ... (spread) definition #12388 [hasezoey](https://github.com/hasezoey)
* refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes #12280 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)

6.5.4 / 2022-08-30
==================
* fix(document): allow calling $assertPopulated() with values to better support manual population #12233
* fix(connection+mongoose): better handling for calling model() with 1 argument #12359
* fix(model): allow defining discriminator virtuals and methods using schema options #12326
* fix(types): fix MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" #12330 #12329 [Jule-](https://github.com/Jule-) [lpizzinidev](https://github.com/lpizzinidev)
* fix(types): fix replaceOne return type #12351 [lpizzinidev](https://github.com/lpizzinidev)
* fix(types): use this for return type from $assertPopulated() #12234
* docs: highlight how to connect using auth in README #12354 [AntonyOnScript](https://github.com/AntonyOnScript)
* docs: improve jsdoc comments for private methods #12337 [hasezoey](https://github.com/hasezoey)
* docs: fix minor typo in compatibility table header #12355 [skyme5](https://github.com/skyme5)

6.5.3 / 2022-08-24
==================
* fix(document): handle maps when applying defaults to nested paths #12322
* fix(schema): make ArraySubdocuments apply _id defaults on init #12264
* fix(populate): handle specifying recursive populate as a string with discriminators #12266
* perf(types): remove extends Query in Schema.pre() and Schema.post(), loosen `discriminator()` generic #10349
* perf(types): some more micro-optimizations re: #10349, remove extra type checking on $ne, etc.
* fix(types): infer schema on `connection.model()` #12298 #12125 [hasezoey](https://github.com/hasezoey)
* fix(types): add missing `findById()` type definitions #12309 [lpizzinidev](https://github.com/lpizzinidev)
* fix(types): allow $search in $lookup pipeline stages for MongoDB v6.x support #12278 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(types): add parameter "options" to "Model.remove" #12258 [hasezoey](https://github.com/hasezoey)
* fix(types): sync single-generic-no-constraint "model" between "index.d.ts" and "connection.d.ts" #12299 [hasezoey](https://github.com/hasezoey)
* fix(types): update isDirectModified typing #12290 [gabrielDonnantuoni](https://github.com/gabrielDonnantuoni)
* docs: update links on api docs #12293 [eatmoarrice](https://github.com/eatmoarrice)
* docs: add note about language_override option #12310 [IslandRhythms](https://github.com/IslandRhythms)
* docs(document): add "String[]" to Document.depopulate as jsdoc parameter type #12300 [hasezoey](https://github.com/hasezoey)
* docs: update Node.js EventEmitter url #12303 [rainrisa](https://github.com/rainrisa)

5.13.15 / 2022-08-22
====================
* fix: backport fix for CVE-2022-2564 #12281 [shubanker](https://github.com/shubanker)
* docs: fix broken link from findandmodify method deprecation #11366 [laissonsilveira](https://github.com/laissonsilveira)

6.5.2 / 2022-08-09
==================
* fix(aggregate): avoid throwing error when disconnecting with change stream open #12201 [ramos-ph](https://github.com/ramos-ph)
* fix(query): overwrite top-level key if using Query.prototype.set() to set to undefined #12155
* fix(query): shallow clone options before modifying #12176
* fix(types): auto schema type inference on `Connection.prototype.model()` #12240 [hasezoey](https://github.com/hasezoey)
* fix(types): better typescript support for schema plugins #12139 [emiljanitzek](https://github.com/emiljanitzek)
* fix(types): make bulkWrite() type param optional #12221 #12212
* docs: misc cleanup #12199 [hasezoey](https://github.com/hasezoey)
* docs: highlight current top-most visible header in navbar #12222 [hasezoey](https://github.com/hasezoey)
* docs(populate): improve examples for Document.prototype.populate() #12111
* docs(middleware): clarify document vs model in middleware docs #12113

6.5.1 / 2022-08-03
==================
* fix(timestamps): set timestamps on child schema when child schema has timestamps: true but parent schema does not #12119
* fix(schema+timestamps): handle insertMany() with timestamps and discriminators #12150
* fix(model+query): handle populate with lean transform that deletes _id #12143
* fix(types): allow $pull with _id #12142
* fix(types): add schema plugin option inference #12196 [hasezoey](https://github.com/hasezoey)
* fix(types): pass type to mongodb bulk write operation #12167 [emiljanitzek](https://github.com/emiljanitzek)
* fix(types): map correct generics from model to schema #12125 [emiljanitzek](https://github.com/emiljanitzek)
* fix(types): avoid baffling circular reference when using PopulatedDoc with a bidirectional reference #12136
* fix(types): allow using path with $count #12149
* docs(compatibility): change to use a table #12200 [hasezoey](https://github.com/hasezoey)
* docs(api_split.pug): add "code" to sidebar entries #12153 [hasezoey](https://github.com/hasezoey)
* docs: add "code" to Headers (and index list) #12152 [hasezoey](https://github.com/hasezoey)

6.5.0 / 2022-07-26
==================
* perf(document): avoid creating unnecessary empty objects when creating a state machine #11988
* feat: upgrade mongodb driver -> 4.8.1 #12103 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(model): allow passing timestamps option to Model.bulkSave(...) #12082 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* feat(model): add castObject() function that casts a POJO to the model's schema #11945
* feat(document): add $inc() helper that increments numeric paths #12115
* feat(schema): add schema level lean option [IslandRhythms](https://github.com/IslandRhythms)
* feat(schema): add global id option to disable id on schemas #12067 [IslandRhythms](https://github.com/IslandRhythms)
* fix(connection): re-run Model.init() if re-connecting after explicitly closing a connection #12130
* feat(model): add applyDefaults() helper that allows applying defaults to document or POJO #11945
* feat(model): allow calling hydrate() with { setters: true } #11653
* feat(model): add hydrate option to Model.watch() to automatically hydrate fullDocument #12121
* feat(types): add support for automatically typed virtuals in schemas #11908 [mohammad0-0ahmad](https://github.com/mohammad0-0ahmad)

6.4.7 / 2022-07-25
==================
* fix(virtualtype): use $locals for default virtual getter/setter rather than top-level doc #12124
* fix(document): call subdocument getters if child schema has getters: true #12105
* fix(schematype): actually always return "this" where specified #12141 [hasezoey](https://github.com/hasezoey)
* fix(types): correct return value for Model.exists() #12094
* docs(guides): add link to advanced schemas doc #12073
* docs: handle @see in jsdoc #12144 [hasezoey](https://github.com/hasezoey)
* docs: make use of the deprecated tag available in jsdoc for documentation #12080 [hasezoey](https://github.com/hasezoey)
* docs(api_split): add basic DEPRECATED output #12146 [hasezoey](https://github.com/hasezoey)
* docs: various jsdoc cleanup #12140 [hasezoey](https://github.com/hasezoey)
* docs(api_split.pug): add "code" to parameter name #12145 [hasezoey](https://github.com/hasezoey)

6.4.6 / 2022-07-20
==================
* fix(schema): disallow setting __proto__ when creating schema with dotted properties #12085
Loading