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: 018074699cf04c1f32bffdfce3253b9027f6955a
Choose a base ref
...
head repository: Automattic/mongoose
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c00a715e97c6437a5ff1a503c2a50ebd0df2ba47
Choose a head ref
Loading
Showing with 4,044 additions and 1,856 deletions.
  1. +232 −0 .eslintrc.js
  2. +0 −194 .eslintrc.json
  3. +1 −0 .github/workflows/documentation.yml
  4. +2 −14 .github/workflows/test.yml
  5. +5 −0 .gitignore
  6. +133 −0 CHANGELOG.md
  7. +15 −15 README.md
  8. +70 −38 benchmarks/get.js
  9. +55 −0 benchmarks/mapOfSubdocs.js
  10. +4 −4 docs/advanced_schemas.md
  11. +7 −7 docs/api.pug
  12. +11 −11 docs/api_split.pug
  13. +31 −31 docs/async-await.md
  14. +4 −4 docs/change-streams.md
  15. +34 −0 docs/check-version.md
  16. +16 −16 docs/connections.md
  17. +0 −3 docs/contributing.md
  18. +4 −4 docs/customschematypes.md
  19. +9 −9 docs/defaults.md
  20. +11 −11 docs/discriminators.md
  21. +4 −4 docs/documents.md
  22. +3 −3 docs/enterprise.md
  23. +8 −6 docs/faq.md
  24. +3 −9 docs/geojson.md
  25. +119 −114 docs/guide.md
  26. +9 −6 docs/guides.md
  27. +14 −13 docs/includes/favicon.pug
  28. +1 −1 docs/includes/native.pug
  29. +5 −5 docs/index.md
  30. +6 −0 docs/jest.md
  31. +29 −28 docs/js/api-bold-current-nav.js
  32. +0 −6 docs/js/cookies.min.js
  33. +11 −10 docs/js/mobile-navbar-toggle.js
  34. +6 −7 docs/js/navbar-search.js
  35. +17 −16 docs/js/search.js
  36. +0 −4 docs/js/zepto.min.js
  37. +3 −7 docs/lambda.md
  38. +71 −65 docs/layout.pug
  39. +14 −6 docs/loadSponsorData.js
  40. +24 −24 docs/middleware.md
  41. +87 −85 docs/migrating_to_5.md
  42. +51 −40 docs/migrating_to_6.md
  43. +5 −5 docs/migration.md
  44. +3 −3 docs/models.md
  45. +11 −11 docs/plugins.md
  46. +46 −45 docs/populate.md
  47. +0 −8 docs/prior.pug
  48. +10 −10 docs/promises.md
  49. +20 −20 docs/queries.md
  50. +81 −41 docs/schematypes.md
  51. +3 −3 docs/search.pug
  52. +38 −20 docs/source/api.js
  53. +5 −5 docs/source/home.js
  54. +75 −44 docs/source/index.js
  55. +8 −0 docs/source/tutorials.js
  56. +7 −0 docs/source/typescript.js
  57. +29 −0 docs/source/utils.js
  58. +0 −25 docs/splitApiDocs.js
  59. +3 −3 docs/sponsors.pug
  60. +17 −17 docs/subdocs.md
  61. +8 −8 docs/timestamps.md
  62. +10 −10 docs/transactions.md
  63. +2 −2 docs/tutorials/custom-casting.md
  64. +6 −6 docs/tutorials/dates.md
  65. +6 −6 docs/tutorials/findoneandupdate.md
  66. +8 −9 docs/tutorials/getters-setters.md
  67. +0 −15 docs/tutorials/index.js
  68. +5 −5 docs/tutorials/lean.md
  69. +9 −11 docs/tutorials/query_casting.md
  70. +2 −2 docs/tutorials/ssl.md
  71. +6 −6 docs/tutorials/virtuals.md
  72. +5 −5 docs/typescript.md
  73. +0 −14 docs/typescript/index.js
  74. +4 −4 docs/typescript/query-helpers.md
  75. +6 −6 docs/typescript/schemas.md
  76. +3 −2 docs/typescript/statics-and-methods.md
  77. +2 −2 docs/typescript/statics.md
  78. +5 −5 docs/typescript/virtuals.md
  79. +32 −31 docs/validation.md
  80. +27 −0 docs/version-support.md
  81. +1 −1 lib/aggregate.js
  82. +1 −8 lib/cast.js
  83. +10 −0 lib/connection.js
  84. +1 −1 lib/cursor/AggregationCursor.js
  85. +4 −1 lib/cursor/ChangeStream.js
  86. +2 −1 lib/cursor/QueryCursor.js
  87. +156 −78 lib/document.js
  88. +24 −5 lib/drivers/node-mongodb-native/collection.js
  89. +1 −1 lib/error/objectParameter.js
  90. +2 −1 lib/helpers/discriminator/mergeDiscriminatorSchema.js
  91. +3 −1 lib/helpers/document/applyDefaults.js
  92. +11 −1 lib/helpers/document/compile.js
  93. +0 −39 lib/helpers/path/flattenObjectWithDottedPaths.js
  94. +15 −11 lib/helpers/printJestWarning.js
  95. +4 −3 lib/helpers/processConnectionOptions.js
  96. +1 −0 lib/helpers/projection/hasIncludedChildren.js
  97. +8 −0 lib/helpers/projection/isNestedProjection.js
  98. +0 −1 lib/helpers/schema/getPath.js
  99. +3 −1 lib/index.js
  100. +122 −39 lib/model.js
  101. +50 −56 lib/query.js
  102. +36 −7 lib/schema.js
  103. +100 −0 lib/schema/DocumentArrayElement.js
  104. +6 −4 lib/schema/SubdocumentPath.js
  105. +2 −2 lib/schema/array.js
  106. +13 −32 lib/schema/documentarray.js
  107. +14 −9 lib/schema/uuid.js
  108. +6 −3 lib/schematype.js
  109. +1 −1 lib/types/ArraySubdocument.js
  110. +8 −10 lib/types/array/methods/index.js
  111. +25 −11 lib/types/map.js
  112. +3 −3 lib/types/subdocument.js
  113. +2 −0 lib/utils.js
  114. +23 −10 package.json
  115. +17 −21 scripts/generateSearch.js
  116. +11 −2 scripts/static.js
  117. +230 −35 scripts/website.js
  118. +2 −1 test/.eslintrc.yml
  119. +1 −0 test/collection.capped.test.js
  120. +13 −0 test/collection.test.js
  121. +14 −15 test/connection.test.js
  122. +25 −36 test/deno.js
  123. +54 −0 test/deno_mocha.js
  124. +5 −5 test/docs/asyncIterator.test.js
  125. +30 −48 test/docs/cast.test.js
  126. +2 −2 test/docs/date.test.js
  127. +16 −6 test/docs/debug.test.js
  128. +2 −2 test/docs/defaults.test.js
  129. +5 −5 test/docs/discriminators.test.js
  130. +7 −7 test/docs/findoneandupdate.test.js
  131. +8 −6 test/docs/getters-setters.test.js
  132. +3 −3 test/docs/lean.test.js
  133. +24 −24 test/docs/promises.test.js
  134. +2 −2 test/docs/schemas.test.js
  135. +22 −22 test/docs/transactions.test.js
  136. +3 −3 test/docs/validation.test.js
  137. +5 −6 test/docs/virtuals.test.js
  138. +53 −0 test/document.modified.test.js
  139. +415 −7 test/document.test.js
  140. +32 −0 test/index.test.js
  141. +6 −0 test/mocha-fixtures.js
  142. +69 −0 test/model.discriminator.test.js
  143. +0 −1 test/model.findOneAndReplace.test.js
  144. +10 −0 test/model.findOneAndUpdate.test.js
  145. +66 −0 test/model.indexes.test.js
  146. +57 −0 test/model.populate.test.js
  147. +156 −0 test/model.test.js
  148. +29 −0 test/model.update.test.js
  149. +24 −0 test/query.cursor.test.js
  150. +45 −1 test/query.test.js
  151. +20 −1 test/schema.test.js
  152. +22 −2 test/schema.uuid.test.js
  153. +68 −5 test/schema.validation.test.js
  154. +18 −0 test/types.documentarray.test.js
  155. +1 −0 test/types.map.test.js
  156. +49 −2 test/types/models.test.ts
  157. +17 −0 test/types/mongo.test.ts
  158. +30 −0 test/types/populate.test.ts
  159. +8 −0 test/types/querycursor.test.ts
  160. +2 −2 test/virtualtype.test.js
  161. +9 −0 types/augmentations.d.ts
  162. +4 −4 types/cursor.d.ts
  163. +1 −1 types/document.d.ts
  164. +1 −0 types/index.d.ts
  165. +35 −8 types/models.d.ts
  166. +1 −1 types/types.d.ts
  167. +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