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: 783a5de154b961c1ed470bfd6e4ee3dca6815293
Choose a base ref
...
head repository: Automattic/mongoose
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 29f57c12caee006f2434a0ef9b21aace9b30fdcf
Choose a head ref

Commits on Nov 2, 2022

  1. Copy the full SHA
    d962724 View commit details
  2. test: add test for gh-11943

    maciasello committed Nov 2, 2022

    Verified

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

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

Commits on Nov 14, 2022

  1. Copy the full SHA
    1a2d7f8 View commit details
  2. Copy the full SHA
    9ca46d1 View commit details
  3. Copy the full SHA
    8b306eb View commit details
  4. Copy the full SHA
    0cd01da View commit details

Commits on Dec 8, 2022

  1. Copy the full SHA
    a036c12 View commit details

Commits on Dec 9, 2022

  1. update tests

    JavaScriptBach committed Dec 9, 2022
    Copy the full SHA
    3611dd0 View commit details
  2. lint

    JavaScriptBach committed Dec 9, 2022
    Copy the full SHA
    8327ccf View commit details

Commits on Jan 3, 2023

  1. Update middleware.md

    IslandRhythms committed Jan 3, 2023
    Copy the full SHA
    790ba1e View commit details

Commits on Jan 6, 2023

  1. Add guard to stop loadClass copying Document if Document is used as b…

    …ase of loaded class (same hack as implemented for Model already).
    sgpinkus committed Jan 6, 2023
    Copy the full SHA
    c63cffb View commit details

Commits on Jan 7, 2023

  1. Copy the full SHA
    969dcdc View commit details
  2. Copy the full SHA
    b248ca3 View commit details
  3. chore(workflows/test): update "setup-node" version for the deno tests (

    …#12886)
    
    this should get rid of the "set-output is deprecated" warning
    hasezoey authored Jan 7, 2023
    Copy the full SHA
    00d3660 View commit details

Commits on Jan 8, 2023

  1. Copy the full SHA
    f69f367 View commit details
  2. Copy the full SHA
    2a9a457 View commit details
  3. fix(collection): handle creating model when connection disconnected w…

    …ith bufferCommands = false
    vkarpov15 committed Jan 8, 2023
    Copy the full SHA
    7f4921e View commit details
  4. Copy the full SHA
    743acf6 View commit details
  5. Copy the full SHA
    50fbb29 View commit details
  6. test(docs/): add "after" calls to disconnect all connections

    to prevent connections from leaking across tests
    hasezoey committed Jan 8, 2023
    Copy the full SHA
    1fa4d74 View commit details
  7. Copy the full SHA
    44535ad View commit details
  8. Copy the full SHA
    0580240 View commit details
  9. Copy the full SHA
    9b3f8f7 View commit details
  10. Copy the full SHA
    9f7715b View commit details
  11. Copy the full SHA
    8d14da3 View commit details
  12. Copy the full SHA
    95f4b06 View commit details
  13. Copy the full SHA
    aae473a View commit details
  14. Copy the full SHA
    684d6ce View commit details
  15. Copy the full SHA
    07378d3 View commit details
  16. Copy the full SHA
    d8795c6 View commit details
  17. Copy the full SHA
    6fa82ed View commit details

Commits on Jan 9, 2023

  1. made requested changes

    IslandRhythms committed Jan 9, 2023
    Copy the full SHA
    004f55e View commit details
  2. Merge pull request #12868 from Automattic/IslandRhythms/middleware-st…

    …rings
    
    list all possible strings for schema.pre
    vkarpov15 authored Jan 9, 2023
    Copy the full SHA
    6d7f0e8 View commit details
  3. Merge pull request #12892 from Automattic/vkarpov15/gh-12671

    docs: add list of known incompatible npm packages
    vkarpov15 authored Jan 9, 2023
    Copy the full SHA
    456be2b View commit details
  4. rm accidental import

    JavaScriptBach committed Jan 9, 2023
    Copy the full SHA
    aa44bda View commit details

Commits on Jan 10, 2023

  1. Merge pull request #12820 from sgpinkus/feat/allow-doc-as-base-for-lo…

    …adclass
    
    Add guard to stop loadClass copying Document if Document is used as base of loaded class (same hack as implemented for Model already).
    vkarpov15 authored Jan 10, 2023
    Copy the full SHA
    34bda70 View commit details
  2. Merge pull request #12891 from Automattic/vkarpov15/gh-12834

    fix(populate): merge instead of overwrite when `match` is on `_id`
    vkarpov15 authored Jan 10, 2023
    Copy the full SHA
    6e14876 View commit details
  3. handle string case

    JavaScriptBach committed Jan 10, 2023
    Copy the full SHA
    054b704 View commit details
  4. Copy the full SHA
    d2492ea View commit details
  5. Copy the full SHA
    3160949 View commit details

Commits on Jan 12, 2023

  1. Copy the full SHA
    45aa436 View commit details

Commits on Jan 13, 2023

  1. Update query.d.ts

    AbdelrahmanHafez authored Jan 13, 2023
    Copy the full SHA
    c820587 View commit details
  2. Copy the full SHA
    18944ba View commit details
  3. Merge pull request #12906 from Automattic/update-types

    types(query):  `returnDocument` type safety
    AbdelrahmanHafez authored Jan 13, 2023
    Copy the full SHA
    78b3b54 View commit details

Commits on Jan 14, 2023

  1. Merge pull request #12903 from lpizzinidev/gh-12859

    types(lean): added omit for `ArraySubdocument` type in `LeanType` declaration
    vkarpov15 authored Jan 14, 2023
    Copy the full SHA
    c91a987 View commit details
  2. Merge pull request #12898 from 0x0a0d/fix-strict-return-all

    fix(cast): remove empty conditions after strict applied
    vkarpov15 authored Jan 14, 2023
    Copy the full SHA
    629b1ed View commit details
  3. Merge pull request #12897 from lpizzinidev/gh-12885

    docs(schematypes): removed dead link and fixed formatting
    vkarpov15 authored Jan 14, 2023
    Copy the full SHA
    a6fd84b View commit details

Commits on Jan 16, 2023

  1. Copy the full SHA
    dc136ab View commit details
  2. docs(typescript): add notes about virtual context to Mongoose 6 migra…

    …tion and TypeScript virtuals docs
    
    Fix #12806
    vkarpov15 committed Jan 16, 2023
    Copy the full SHA
    a1b90e6 View commit details
Showing with 6,001 additions and 2,814 deletions.
  1. +232 −0 .eslintrc.js
  2. +0 −194 .eslintrc.json
  3. +1 −1 .github/ISSUE_TEMPLATE/bug.yml
  4. +2 −2 .github/workflows/benchmark.yml
  5. +1 −1 .github/workflows/codeql.yml
  6. +3 −2 .github/workflows/documentation.yml
  7. +20 −33 .github/workflows/test.yml
  8. +2 −2 .github/workflows/tidelift-alignment.yml
  9. +4 −4 .github/workflows/tsd.yml
  10. +6 −1 .gitignore
  11. +198 −0 CHANGELOG.md
  12. +17 −17 README.md
  13. +70 −38 benchmarks/get.js
  14. +55 −0 benchmarks/mapOfSubdocs.js
  15. +4 −4 docs/advanced_schemas.md
  16. +7 −7 docs/api.pug
  17. +11 −11 docs/api_split.pug
  18. +31 −31 docs/async-await.md
  19. +6 −6 docs/change-streams.md
  20. +34 −0 docs/check-version.md
  21. +1 −1 docs/compatibility.md
  22. +26 −26 docs/connections.md
  23. +0 −3 docs/contributing.md
  24. +4 −4 docs/customschematypes.md
  25. +10 −10 docs/defaults.md
  26. +4 −4 docs/deprecations.md
  27. +11 −11 docs/discriminators.md
  28. +6 −6 docs/documents.md
  29. +3 −3 docs/enterprise.md
  30. +12 −10 docs/faq.md
  31. +8 −14 docs/geojson.md
  32. +148 −144 docs/guide.md
  33. +9 −6 docs/guides.md
  34. +14 −13 docs/includes/favicon.pug
  35. +1 −1 docs/includes/native.pug
  36. +4 −0 docs/incompatible_packages.md
  37. +6 −6 docs/index.md
  38. +6 −0 docs/jest.md
  39. +29 −28 docs/js/api-bold-current-nav.js
  40. +0 −6 docs/js/cookies.min.js
  41. +11 −10 docs/js/mobile-navbar-toggle.js
  42. +6 −7 docs/js/navbar-search.js
  43. +17 −16 docs/js/search.js
  44. +0 −4 docs/js/zepto.min.js
  45. +3 −13 docs/lambda.md
  46. +71 −65 docs/layout.pug
  47. +14 −6 docs/loadSponsorData.js
  48. +53 −28 docs/middleware.md
  49. +91 −89 docs/migrating_to_5.md
  50. +70 −40 docs/migrating_to_6.md
  51. +6 −6 docs/migration.md
  52. +8 −8 docs/models.md
  53. +12 −12 docs/plugins.md
  54. +49 −48 docs/populate.md
  55. +0 −8 docs/prior.pug
  56. +10 −10 docs/promises.md
  57. +27 −27 docs/queries.md
  58. +90 −51 docs/schematypes.md
  59. +3 −3 docs/search.pug
  60. +107 −40 docs/source/api.js
  61. +5 −5 docs/source/home.js
  62. +75 −43 docs/source/index.js
  63. +8 −0 docs/source/tutorials.js
  64. +7 −0 docs/source/typescript.js
  65. +29 −0 docs/source/utils.js
  66. +0 −29 docs/splitApiDocs.js
  67. +3 −3 docs/sponsors.pug
  68. +21 −24 docs/subdocs.md
  69. +9 −9 docs/timestamps.md
  70. +26 −13 docs/transactions.md
  71. +3 −3 docs/tutorials/custom-casting.md
  72. +6 −6 docs/tutorials/dates.md
  73. +9 −9 docs/tutorials/findoneandupdate.md
  74. +23 −14 docs/tutorials/getters-setters.md
  75. +0 −15 docs/tutorials/index.js
  76. +11 −11 docs/tutorials/lean.md
  77. +10 −12 docs/tutorials/query_casting.md
  78. +4 −5 docs/tutorials/ssl.md
  79. +6 −6 docs/tutorials/virtuals.md
  80. +5 −5 docs/typescript.md
  81. +0 −14 docs/typescript/index.js
  82. +4 −4 docs/typescript/query-helpers.md
  83. +6 −6 docs/typescript/schemas.md
  84. +3 −2 docs/typescript/statics-and-methods.md
  85. +2 −2 docs/typescript/statics.md
  86. +20 −4 docs/typescript/virtuals.md
  87. +40 −39 docs/validation.md
  88. +27 −0 docs/version-support.md
  89. +1 −1 examples/aggregate/aggregate.js
  90. +1 −1 examples/geospatial/geospatial.js
  91. +2 −3 index.pug
  92. +42 −43 lib/aggregate.js
  93. +2 −1 lib/cast.js
  94. +16 −6 lib/connection.js
  95. +2 −2 lib/cursor/AggregationCursor.js
  96. +16 −1 lib/cursor/ChangeStream.js
  97. +3 −2 lib/cursor/QueryCursor.js
  98. +157 −85 lib/document.js
  99. +48 −12 lib/drivers/node-mongodb-native/collection.js
  100. +21 −10 lib/error/index.js
  101. +1 −1 lib/error/objectParameter.js
  102. +1 −1 lib/error/serverSelection.js
  103. +2 −1 lib/helpers/discriminator/mergeDiscriminatorSchema.js
  104. +17 −4 lib/helpers/document/applyDefaults.js
  105. +11 −1 lib/helpers/document/compile.js
  106. +0 −39 lib/helpers/path/flattenObjectWithDottedPaths.js
  107. +11 −0 lib/helpers/populate/createPopulateQueryFilter.js
  108. +15 −11 lib/helpers/printJestWarning.js
  109. +4 −3 lib/helpers/processConnectionOptions.js
  110. +1 −0 lib/helpers/projection/hasIncludedChildren.js
  111. +8 −0 lib/helpers/projection/isNestedProjection.js
  112. +1 −1 lib/helpers/query/cast$expr.js
  113. +1 −12 lib/helpers/query/castUpdate.js
  114. +0 −1 lib/helpers/schema/getPath.js
  115. +38 −10 lib/index.js
  116. +210 −111 lib/model.js
  117. +206 −198 lib/query.js
  118. +109 −9 lib/schema.js
  119. +100 −0 lib/schema/DocumentArrayElement.js
  120. +7 −5 lib/schema/SubdocumentPath.js
  121. +8 −8 lib/schema/array.js
  122. +10 −19 lib/schema/documentarray.js
  123. +1 −1 lib/schema/operators/text.js
  124. +17 −12 lib/schema/uuid.js
  125. +5 −2 lib/schematype.js
  126. +1 −1 lib/types/ArraySubdocument.js
  127. +1 −1 lib/types/array/index.js
  128. +12 −13 lib/types/array/methods/index.js
  129. +1 −1 lib/types/buffer.js
  130. +25 −11 lib/types/map.js
  131. +3 −3 lib/types/subdocument.js
  132. +2 −0 lib/utils.js
  133. +1 −1 lib/virtualtype.js
  134. +37 −22 package.json
  135. +34 −25 docs/search.js → scripts/generateSearch.js
  136. +11 −2 scripts/static.js
  137. +230 −35 scripts/website.js
  138. +2 −1 test/.eslintrc.yml
  139. +1 −0 test/aggregate.test.js
  140. +9 −6 test/collection.capped.test.js
  141. +26 −3 test/collection.test.js
  142. +117 −36 test/connection.test.js
  143. +27 −31 test/deno.js
  144. +54 −0 test/deno_mocha.js
  145. +5 −5 test/docs/asyncIterator.test.js
  146. +5 −1 test/docs/cast.test.js
  147. +5 −4 test/docs/date.test.js
  148. +26 −3 test/docs/debug.test.js
  149. +2 −2 test/docs/defaults.test.js
  150. +5 −5 test/docs/discriminators.test.js
  151. +10 −6 test/docs/findoneandupdate.test.js
  152. +12 −5 test/docs/getters-setters.test.js
  153. +5 −1 test/docs/lean.test.js
  154. +24 −24 test/docs/promises.test.js
  155. +2 −2 test/docs/schemas.test.js
  156. +22 −23 test/docs/transactions.test.js
  157. +4 −4 test/docs/validation.test.js
  158. +8 −5 test/docs/virtuals.test.js
  159. +53 −0 test/document.modified.test.js
  160. +408 −7 test/document.test.js
  161. +2 −1 test/errors.validation.test.js
  162. +2 −0 test/helpers/clone.test.js
  163. +4 −1 test/helpers/indexes.getRelatedIndexes.test.js
  164. +2 −0 test/helpers/indexes.isIndexEqual.test.js
  165. +2 −0 test/helpers/isMongooseObject.test.js
  166. +2 −0 test/helpers/isSimpleValidator.test.js
  167. +3 −2 test/helpers/populate.getSchemaTypes.test.js
  168. +3 −1 test/helpers/populate.getVirtual.test.js
  169. +3 −1 test/helpers/projection.applyProjection.test.js
  170. +44 −5 test/index.test.js
  171. +6 −0 test/mocha-fixtures.js
  172. +21 −0 test/model.discriminator.querying.test.js
  173. +69 −0 test/model.discriminator.test.js
  174. +0 −1 test/model.findOneAndReplace.test.js
  175. +10 −5 test/model.findOneAndUpdate.test.js
  176. +66 −0 test/model.indexes.test.js
  177. +110 −0 test/model.populate.test.js
  178. +226 −98 test/model.test.js
  179. +31 −2 test/model.update.test.js
  180. +79 −0 test/model.watch.test.js
  181. +24 −0 test/query.cursor.test.js
  182. +0 −2 test/query.middleware.test.js
  183. +79 −11 test/query.test.js
  184. +159 −9 test/schema.test.js
  185. +50 −2 test/schema.uuid.test.js
  186. +68 −5 test/schema.validation.test.js
  187. +18 −0 test/types.documentarray.test.js
  188. +1 −0 test/types.map.test.js
  189. +8 −15 test/types.subdocument.test.js
  190. +2 −0 test/types/.eslintrc.yml
  191. +5 −5 test/types/PipelineStage.test.ts
  192. +7 −0 test/types/expressions.test.ts
  193. +12 −2 test/types/lean.test.ts
  194. +57 −3 test/types/models.test.ts
  195. +17 −0 test/types/mongo.test.ts
  196. +30 −0 test/types/populate.test.ts
  197. +9 −0 test/types/queries.test.ts
  198. +8 −0 test/types/querycursor.test.ts
  199. +102 −0 test/types/schema.test.ts
  200. +32 −0 test/types/subdocuments.test.ts
  201. +2 −2 test/virtualtype.test.js
  202. +4 −67 types/aggregate.d.ts
  203. +9 −0 types/augmentations.d.ts
  204. +4 −4 types/connection.d.ts
  205. +4 −4 types/cursor.d.ts
  206. +1 −1 types/document.d.ts
  207. +5 −0 types/error.d.ts
  208. +154 −153 types/expressions.d.ts
  209. +12 −8 types/index.d.ts
  210. +29 −10 types/inferschematype.d.ts
  211. +38 −11 types/models.d.ts
  212. +8 −1 types/mongooseoptions.d.ts
  213. +39 −35 types/pipelinestage.d.ts
  214. +11 −11 types/query.d.ts
  215. +1 −1 types/schematypes.d.ts
  216. +4 −4 types/session.d.ts
  217. +1 −1 types/types.d.ts
  218. +1 −0 types/validation.d.ts
232 changes: 232 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
'use strict';

module.exports = {
extends: [
'eslint:recommended'
],
ignorePatterns: [
'tools',
'dist',
'website.js',
'test/files/*',
'benchmarks',
'*.min.js',
'docs/js/native.js'
],
overrides: [
{
files: [
'**/*.{ts,tsx}',
'**/*.md/*.ts',
'**/*.md/*.typescript'
],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended'
],
plugins: [
'@typescript-eslint'
],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'spaced-comment': [
'error',
'always',
{
block: {
markers: [
'!'
],
balanced: true
},
markers: [
'/'
]
}
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/indent': [
'warn',
2,
{
SwitchCase: 1,
ignoredNodes: ['TSTypeParameterInstantiation']
}
],
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/brace-style': 'error',
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/object-curly-spacing': [
'error',
'always'
],
'@typescript-eslint/semi': 'error',
'@typescript-eslint/space-before-function-paren': [
'error',
'never'
],
'@typescript-eslint/space-infix-ops': 'off'
}
},
{
files: [
'docs/js/**/*.js'
],
env: {
node: false,
browser: true
}
}
// // eslint-plugin-markdown has been disabled because of out-standing issues, see https://github.com/eslint/eslint-plugin-markdown/issues/214
// {
// files: ['**/*.md'],
// processor: 'markdown/markdown'
// },
// {
// files: ['**/*.md/*.js', '**/*.md/*.javascript', '**/*.md/*.ts', '**/*.md/*.typescript'],
// parserOptions: {
// ecmaFeatures: {
// impliedStrict: true
// },
// sourceType: 'module', // required to allow "import" statements
// ecmaVersion: 'latest' // required to allow top-level await
// },
// rules: {
// 'no-undef': 'off',
// 'no-unused-expressions': 'off',
// 'no-unused-vars': 'off',
// 'no-redeclare': 'off',
// '@typescript-eslint/no-redeclare': 'off'
// }
// }
],
plugins: [
'mocha-no-only'
// 'markdown'
],
parserOptions: {
ecmaVersion: 2020
},
env: {
node: true,
es6: true
},
rules: {
'comma-style': 'error',
indent: [
'error',
2,
{
SwitchCase: 1,
VariableDeclarator: 2
}
],
'keyword-spacing': 'error',
'no-whitespace-before-property': 'error',
'no-buffer-constructor': 'warn',
'no-console': 'off',
'no-constant-condition': 'off',
'no-multi-spaces': 'error',
'func-call-spacing': 'error',
'no-trailing-spaces': 'error',
'no-undef': 'error',
'no-unneeded-ternary': 'error',
'no-const-assign': 'error',
'no-useless-rename': 'error',
'no-dupe-keys': 'error',
'space-in-parens': [
'error',
'never'
],
'spaced-comment': [
'error',
'always',
{
block: {
markers: [
'!'
],
balanced: true
}
}
],
'key-spacing': [
'error',
{
beforeColon: false,
afterColon: true
}
],
'comma-spacing': [
'error',
{
before: false,
after: true
}
],
'array-bracket-spacing': 1,
'arrow-spacing': [
'error',
{
before: true,
after: true
}
],
'object-curly-spacing': [
'error',
'always'
],
'comma-dangle': [
'error',
'never'
],
'no-unreachable': 'error',
quotes: [
'error',
'single'
],
'quote-props': [
'error',
'as-needed'
],
semi: 'error',
'no-extra-semi': 'error',
'semi-spacing': 'error',
'no-spaced-func': 'error',
'no-throw-literal': 'error',
'space-before-blocks': 'error',
'space-before-function-paren': [
'error',
'never'
],
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'no-var': 'warn',
'prefer-const': 'warn',
strict: [
'error',
'global'
],
'no-restricted-globals': [
'error',
{
name: 'context',
message: 'Don\'t use Mocha\'s global context'
}
],
'no-prototype-builtins': 'off',
'mocha-no-only/mocha-no-only': [
'error'
],
'no-empty': 'off',
'eol-last': 'warn',
'no-multiple-empty-lines': ['warn', { max: 2 }]
}
};
Loading