@nullix/zod-mongoose-studio 1.0.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{Db4IAypj.js → 0J_bLG6U.js} +1 -1
- package/.output/public/_nuxt/{Y39o1QEi.js → 5KLjKHc1.js} +1 -1
- package/.output/public/_nuxt/{B4zoPYF-.js → B2UrsJHg.js} +1 -1
- package/.output/public/_nuxt/{BSqjh6Vk.js → BC5hGokz.js} +1 -1
- package/.output/public/_nuxt/{BS4yU4O0.js → BJwN20Xm.js} +1 -1
- package/.output/public/_nuxt/{D8_n84hl.js → BMgDPqps.js} +1 -1
- package/.output/public/_nuxt/{CqNsQbt9.js → B_sGF2qN.js} +1 -1
- package/.output/public/_nuxt/{NAqlztEN.js → BeaJ7I-K.js} +10 -10
- package/.output/public/_nuxt/{WZ0WK9cR.js → BkE1sm_1.js} +1 -1
- package/.output/public/_nuxt/{kBtP64Rx.js → CADbZwE5.js} +1 -1
- package/.output/public/_nuxt/{B8qGaxNm.js → CB0WRoVi.js} +1 -1
- package/.output/public/_nuxt/{BV6uALfO.js → CCh0PVV0.js} +1 -1
- package/.output/public/_nuxt/{CP9Z7-_9.js → Cr0GW7rA.js} +1 -1
- package/.output/public/_nuxt/{DeCqoVOS.js → DJe7Wxdv.js} +1 -1
- package/.output/public/_nuxt/{dBZQW7JD.js → DRBrUaE5.js} +1 -1
- package/.output/public/_nuxt/{Db19R32y.js → DV2n9B6m.js} +1 -1
- package/.output/public/_nuxt/{CvnpbYw0.js → DVD-jGiv.js} +1 -1
- package/.output/public/_nuxt/{BWajNATZ.js → Dk9qGA5X.js} +3 -3
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/dc761332-547d-4953-b51d-b2d453009b48.json +1 -0
- package/.output/public/_nuxt/error-404.64pZEiDn.css +1 -0
- package/.output/public/_nuxt/error-500.DHOpI0Ir.css +1 -0
- package/.output/public/_nuxt/{BoHhCIKW.js → koEZfutw.js} +3 -3
- package/.output/public/_nuxt/{B_782F4p.js → r6LdR7DN.js} +1 -1
- package/.output/public/_nuxt/{BEI71c6K.js → rEfOp38p.js} +1 -1
- package/.output/server/chunks/_/error-500.mjs.map +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{error-404-8tbBXju4.mjs → error-404-BN-7rNE4.mjs} +4 -4
- package/.output/server/chunks/build/error-404-BN-7rNE4.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-styles.Byx46oLR.mjs +8 -0
- package/.output/server/chunks/build/error-404-styles.Byx46oLR.mjs.map +1 -0
- package/.output/server/chunks/build/{error-500-DxFsom1i.mjs → error-500-DhIQ-2yt.mjs} +4 -4
- package/.output/server/chunks/build/error-500-DhIQ-2yt.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-styles.BL3UT0Wa.mjs +8 -0
- package/.output/server/chunks/build/error-500-styles.BL3UT0Wa.mjs.map +1 -0
- package/.output/server/chunks/build/{index-BB-Clavm.mjs → index-Dnrh1ePF.mjs} +1 -1
- package/.output/server/chunks/build/index-Dnrh1ePF.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +9 -9
- package/.output/server/chunks/build/styles.mjs +4 -4
- package/.output/server/chunks/nitro/nitro.mjs +333 -333
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/renderer.mjs.map +1 -1
- package/.output/server/node_modules/bson/lib/bson.cjs +157 -48
- package/.output/server/node_modules/bson/package.json +9 -11
- package/.output/server/node_modules/kareem/index.js +228 -343
- package/.output/server/node_modules/kareem/package.json +3 -3
- package/.output/server/node_modules/mongodb/lib/bson.js +27 -5
- package/.output/server/node_modules/mongodb/lib/bulk/common.js +7 -9
- package/.output/server/node_modules/mongodb/lib/change_stream.js +91 -39
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js +21 -14
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/client_encryption.js +2 -5
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/errors.js +3 -1
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js +1 -1
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/state_machine.js +1 -0
- package/.output/server/node_modules/mongodb/lib/cmap/auth/aws4.js +161 -0
- package/.output/server/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js +11 -58
- package/.output/server/node_modules/mongodb/lib/cmap/auth/gssapi.js +4 -6
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js +2 -16
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js +14 -23
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +4 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +4 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js +4 -4
- package/.output/server/node_modules/mongodb/lib/cmap/auth/plain.js +1 -1
- package/.output/server/node_modules/mongodb/lib/cmap/auth/providers.js +0 -1
- package/.output/server/node_modules/mongodb/lib/cmap/auth/scram.js +53 -40
- package/.output/server/node_modules/mongodb/lib/cmap/commands.js +46 -39
- package/.output/server/node_modules/mongodb/lib/cmap/connect.js +35 -3
- package/.output/server/node_modules/mongodb/lib/cmap/connection.js +36 -32
- package/.output/server/node_modules/mongodb/lib/cmap/connection_pool.js +67 -67
- package/.output/server/node_modules/mongodb/lib/cmap/connection_pool_events.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/errors.js +1 -1
- package/.output/server/node_modules/mongodb/lib/cmap/handshake/client_metadata.js +15 -13
- package/.output/server/node_modules/mongodb/lib/cmap/metrics.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/compression.js +26 -10
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/constants.js +3 -1
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js +0 -1
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js +9 -9
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/responses.js +2 -2
- package/.output/server/node_modules/mongodb/lib/collection.js +1 -1
- package/.output/server/node_modules/mongodb/lib/connection_string.js +30 -15
- package/.output/server/node_modules/mongodb/lib/cursor/abstract_cursor.js +17 -34
- package/.output/server/node_modules/mongodb/lib/cursor/change_stream_cursor.js +2 -2
- package/.output/server/node_modules/mongodb/lib/cursor/find_cursor.js +37 -26
- package/.output/server/node_modules/mongodb/lib/cursor/run_command_cursor.js +1 -1
- package/.output/server/node_modules/mongodb/lib/db.js +6 -7
- package/.output/server/node_modules/mongodb/lib/deps.js +0 -13
- package/.output/server/node_modules/mongodb/lib/error.js +7 -10
- package/.output/server/node_modules/mongodb/lib/gridfs/download.js +7 -6
- package/.output/server/node_modules/mongodb/lib/gridfs/index.js +9 -9
- package/.output/server/node_modules/mongodb/lib/gridfs/upload.js +17 -23
- package/.output/server/node_modules/mongodb/lib/index.js +2 -4
- package/.output/server/node_modules/mongodb/lib/mongo_client.js +58 -67
- package/.output/server/node_modules/mongodb/lib/mongo_client_auth_providers.js +0 -6
- package/.output/server/node_modules/mongodb/lib/mongo_logger.js +11 -5
- package/.output/server/node_modules/mongodb/lib/mongo_types.js +1 -2
- package/.output/server/node_modules/mongodb/lib/operations/aggregate.js +0 -3
- package/.output/server/node_modules/mongodb/lib/operations/create_collection.js +0 -1
- package/.output/server/node_modules/mongodb/lib/operations/drop.js +8 -9
- package/.output/server/node_modules/mongodb/lib/operations/end_sessions.js +34 -0
- package/.output/server/node_modules/mongodb/lib/operations/execute_operation.js +121 -45
- package/.output/server/node_modules/mongodb/lib/operations/operation.js +1 -0
- package/.output/server/node_modules/mongodb/lib/read_preference.js +10 -14
- package/.output/server/node_modules/mongodb/lib/runtime_adapters.js +32 -0
- package/.output/server/node_modules/mongodb/lib/sdam/monitor.js +8 -8
- package/.output/server/node_modules/mongodb/lib/sdam/server.js +55 -43
- package/.output/server/node_modules/mongodb/lib/sdam/server_description.js +1 -1
- package/.output/server/node_modules/mongodb/lib/sdam/server_selection.js +135 -72
- package/.output/server/node_modules/mongodb/lib/sdam/srv_polling.js +3 -3
- package/.output/server/node_modules/mongodb/lib/sdam/topology.js +37 -77
- package/.output/server/node_modules/mongodb/lib/sdam/topology_description.js +1 -1
- package/.output/server/node_modules/mongodb/lib/sessions.js +150 -40
- package/.output/server/node_modules/mongodb/lib/transactions.js +2 -13
- package/.output/server/node_modules/mongodb/lib/utils.js +42 -90
- package/.output/server/node_modules/mongodb/package.json +49 -45
- package/.output/server/node_modules/mongodb-connection-string-url/lib/index.js +45 -19
- package/.output/server/node_modules/mongodb-connection-string-url/lib/redact.js +30 -19
- package/.output/server/node_modules/mongodb-connection-string-url/package.json +25 -16
- package/.output/server/node_modules/mongoose/lib/aggregate.js +108 -127
- package/.output/server/node_modules/mongoose/lib/cast/bigint.js +3 -3
- package/.output/server/node_modules/mongoose/lib/cast/boolean.js +3 -3
- package/.output/server/node_modules/mongoose/lib/cast/double.js +4 -4
- package/.output/server/node_modules/mongoose/lib/cast/int32.js +2 -2
- package/.output/server/node_modules/mongoose/lib/cast/number.js +6 -6
- package/.output/server/node_modules/mongoose/lib/cast/string.js +3 -3
- package/.output/server/node_modules/mongoose/lib/cast/uuid.js +5 -48
- package/.output/server/node_modules/mongoose/lib/cast.js +16 -24
- package/.output/server/node_modules/mongoose/lib/collection.js +6 -6
- package/.output/server/node_modules/mongoose/lib/connection.js +108 -105
- package/.output/server/node_modules/mongoose/lib/cursor/aggregationCursor.js +23 -33
- package/.output/server/node_modules/mongoose/lib/cursor/changeStream.js +60 -40
- package/.output/server/node_modules/mongoose/lib/cursor/queryCursor.js +21 -25
- package/.output/server/node_modules/mongoose/lib/document.js +712 -531
- package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js +85 -130
- package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js +32 -41
- package/.output/server/node_modules/mongoose/lib/error/cast.js +21 -12
- package/.output/server/node_modules/mongoose/lib/error/createCollectionsError.js +2 -2
- package/.output/server/node_modules/mongoose/lib/error/divergentArray.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/eachAsyncMultiError.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/index.js +3 -3
- package/.output/server/node_modules/mongoose/lib/error/invalidSchemaOption.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/messages.js +1 -0
- package/.output/server/node_modules/mongoose/lib/error/missingSchema.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/objectParameter.js +4 -5
- package/.output/server/node_modules/mongoose/lib/error/overwriteModel.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/setOptionError.js +3 -3
- package/.output/server/node_modules/mongoose/lib/error/strict.js +3 -3
- package/.output/server/node_modules/mongoose/lib/error/strictPopulate.js +2 -2
- package/.output/server/node_modules/mongoose/lib/error/syncIndexes.js +2 -2
- package/.output/server/node_modules/mongoose/lib/error/validation.js +2 -10
- package/.output/server/node_modules/mongoose/lib/error/validator.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/version.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/buildMiddlewareFilter.js +24 -0
- package/.output/server/node_modules/mongoose/lib/helpers/clone.js +35 -18
- package/.output/server/node_modules/mongoose/lib/helpers/common.js +5 -5
- package/.output/server/node_modules/mongoose/lib/helpers/cursor/eachAsync.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getConstructor.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/mergeDiscriminatorSchema.js +10 -5
- package/.output/server/node_modules/mongoose/lib/helpers/document/applyDefaults.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/document/applyTimestamps.js +11 -10
- package/.output/server/node_modules/mongoose/lib/helpers/document/applyVirtuals.js +10 -9
- package/.output/server/node_modules/mongoose/lib/helpers/document/cleanModifiedSubpaths.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/document/compile.js +17 -14
- package/.output/server/node_modules/mongoose/lib/helpers/document/getDeepestSubdocumentForPath.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/document/getEmbeddedDiscriminatorPath.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/document/isInPathsToSave.js +24 -0
- package/.output/server/node_modules/mongoose/lib/helpers/get.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/getRelatedIndexes.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexEqual.js +3 -4
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexSpecEqual.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/isBsonType.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/isMongooseObject.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/isObject.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/isSimpleValidator.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/minimize.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyDefaultsToPOJO.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyHooks.js +55 -54
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyMethods.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyStaticHooks.js +1 -48
- package/.output/server/node_modules/mongoose/lib/helpers/model/castBulkWrite.js +8 -12
- package/.output/server/node_modules/mongoose/lib/helpers/model/discriminator.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/parallelLimit.js +18 -36
- package/.output/server/node_modules/mongoose/lib/helpers/pluralize.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/populate/assignRawDocsToIdStructure.js +4 -11
- package/.output/server/node_modules/mongoose/lib/helpers/populate/assignVals.js +10 -10
- package/.output/server/node_modules/mongoose/lib/helpers/populate/createPopulateQueryFilter.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js +197 -69
- package/.output/server/node_modules/mongoose/lib/helpers/populate/getSchemaTypes.js +15 -15
- package/.output/server/node_modules/mongoose/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/populate/modelNamesFromRefPath.js +10 -2
- package/.output/server/node_modules/mongoose/lib/helpers/populate/setPopulatedVirtualValue.js +5 -5
- package/.output/server/node_modules/mongoose/lib/helpers/printJestWarning.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/processConnectionOptions.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/projection/hasIncludedChildren.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/projection/isSubpath.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/projection/parseProjection.js +9 -4
- package/.output/server/node_modules/mongoose/lib/helpers/query/cast$expr.js +8 -10
- package/.output/server/node_modules/mongoose/lib/helpers/query/castFilterPath.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/query/castUpdate.js +44 -38
- package/.output/server/node_modules/mongoose/lib/helpers/query/getEmbeddedDiscriminatorPath.js +8 -8
- package/.output/server/node_modules/mongoose/lib/helpers/query/handleImmutable.js +8 -8
- package/.output/server/node_modules/mongoose/lib/helpers/schema/applyPlugins.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/schema/applyReadConcern.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js +4 -2
- package/.output/server/node_modules/mongoose/lib/helpers/schema/getIndexes.js +5 -11
- package/.output/server/node_modules/mongoose/lib/helpers/schema/getSubdocumentStrictValue.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/schema/handleIdOption.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/schema/idGetter.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/schematype/handleImmutable.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/setDefaultsOnInsert.js +26 -13
- package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setDocumentTimestamps.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setupTimestamps.js +60 -38
- package/.output/server/node_modules/mongoose/lib/helpers/update/applyTimestampsToUpdate.js +13 -10
- package/.output/server/node_modules/mongoose/lib/helpers/update/castArrayFilters.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/update/decorateUpdateWithVersionKey.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/update/modifiedPaths.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/update/removeUnusedArrayFilters.js +7 -2
- package/.output/server/node_modules/mongoose/lib/helpers/updateValidators.js +58 -119
- package/.output/server/node_modules/mongoose/lib/model.js +940 -946
- package/.output/server/node_modules/mongoose/lib/mongoose.js +131 -79
- package/.output/server/node_modules/mongoose/lib/options/schemaArrayOptions.js +2 -2
- package/.output/server/node_modules/mongoose/lib/options/schemaBufferOptions.js +1 -1
- package/.output/server/node_modules/mongoose/lib/options/schemaDocumentArrayOptions.js +23 -0
- package/.output/server/node_modules/mongoose/lib/options/schemaNumberOptions.js +3 -3
- package/.output/server/node_modules/mongoose/lib/options/schemaObjectIdOptions.js +2 -2
- package/.output/server/node_modules/mongoose/lib/options/schemaStringOptions.js +6 -6
- package/.output/server/node_modules/mongoose/lib/options/schemaSubdocumentOptions.js +23 -0
- package/.output/server/node_modules/mongoose/lib/options/schemaTypeOptions.js +27 -13
- package/.output/server/node_modules/mongoose/lib/options/virtualOptions.js +12 -12
- package/.output/server/node_modules/mongoose/lib/plugins/index.js +0 -1
- package/.output/server/node_modules/mongoose/lib/plugins/saveSubdocs.js +84 -92
- package/.output/server/node_modules/mongoose/lib/plugins/sharding.js +33 -15
- package/.output/server/node_modules/mongoose/lib/plugins/trackTransaction.js +29 -25
- package/.output/server/node_modules/mongoose/lib/query.js +700 -548
- package/.output/server/node_modules/mongoose/lib/queryHelpers.js +34 -32
- package/.output/server/node_modules/mongoose/lib/schema/array.js +69 -113
- package/.output/server/node_modules/mongoose/lib/schema/bigint.js +18 -20
- package/.output/server/node_modules/mongoose/lib/schema/boolean.js +20 -22
- package/.output/server/node_modules/mongoose/lib/schema/buffer.js +23 -25
- package/.output/server/node_modules/mongoose/lib/schema/date.js +19 -21
- package/.output/server/node_modules/mongoose/lib/schema/decimal128.js +16 -18
- package/.output/server/node_modules/mongoose/lib/schema/documentArray.js +94 -131
- package/.output/server/node_modules/mongoose/lib/schema/documentArrayElement.js +50 -16
- package/.output/server/node_modules/mongoose/lib/schema/double.js +16 -18
- package/.output/server/node_modules/mongoose/lib/schema/index.js +1 -0
- package/.output/server/node_modules/mongoose/lib/schema/int32.js +17 -19
- package/.output/server/node_modules/mongoose/lib/schema/map.js +17 -24
- package/.output/server/node_modules/mongoose/lib/schema/mixed.js +14 -14
- package/.output/server/node_modules/mongoose/lib/schema/number.js +38 -28
- package/.output/server/node_modules/mongoose/lib/schema/objectId.js +18 -20
- package/.output/server/node_modules/mongoose/lib/schema/operators/exists.js +1 -1
- package/.output/server/node_modules/mongoose/lib/schema/operators/geospatial.js +1 -1
- package/.output/server/node_modules/mongoose/lib/schema/operators/text.js +4 -4
- package/.output/server/node_modules/mongoose/lib/schema/string.js +42 -27
- package/.output/server/node_modules/mongoose/lib/schema/subdocument.js +47 -58
- package/.output/server/node_modules/mongoose/lib/schema/union.js +54 -4
- package/.output/server/node_modules/mongoose/lib/schema/uuid.js +17 -40
- package/.output/server/node_modules/mongoose/lib/schema.js +235 -176
- package/.output/server/node_modules/mongoose/lib/schemaType.js +227 -158
- package/.output/server/node_modules/mongoose/lib/stateMachine.js +5 -8
- package/.output/server/node_modules/mongoose/lib/types/array/index.js +5 -5
- package/.output/server/node_modules/mongoose/lib/types/array/methods/index.js +27 -28
- package/.output/server/node_modules/mongoose/lib/types/arraySubdocument.js +11 -11
- package/.output/server/node_modules/mongoose/lib/types/buffer.js +15 -15
- package/.output/server/node_modules/mongoose/lib/types/decimal128.js +1 -1
- package/.output/server/node_modules/mongoose/lib/types/documentArray/index.js +4 -4
- package/.output/server/node_modules/mongoose/lib/types/documentArray/methods/index.js +15 -13
- package/.output/server/node_modules/mongoose/lib/types/double.js +1 -1
- package/.output/server/node_modules/mongoose/lib/types/map.js +20 -71
- package/.output/server/node_modules/mongoose/lib/types/objectid.js +1 -1
- package/.output/server/node_modules/mongoose/lib/types/subdocument.js +32 -81
- package/.output/server/node_modules/mongoose/lib/types/uuid.js +1 -1
- package/.output/server/node_modules/mongoose/lib/utils.js +91 -70
- package/.output/server/node_modules/mongoose/lib/validOptions.js +4 -3
- package/.output/server/node_modules/mongoose/lib/virtualType.js +18 -18
- package/.output/server/node_modules/mongoose/package.json +46 -63
- package/.output/server/node_modules/mquery/lib/collection/collection.js +3 -1
- package/.output/server/node_modules/mquery/lib/collection/node.js +17 -3
- package/.output/server/node_modules/mquery/lib/mquery.js +136 -93
- package/.output/server/node_modules/mquery/lib/permissions.js +21 -6
- package/.output/server/node_modules/mquery/package.json +4 -7
- package/.output/server/package.json +7 -9
- package/package.json +3 -3
- package/.output/public/_nuxt/builds/meta/0d6006db-fbb0-4297-85cf-bf92ceafcb79.json +0 -1
- package/.output/public/_nuxt/error-404.CTWLHxjC.css +0 -1
- package/.output/public/_nuxt/error-500.UBfk8-QP.css +0 -1
- package/.output/server/chunks/build/error-404-8tbBXju4.mjs.map +0 -1
- package/.output/server/chunks/build/error-404-styles.BeWfK6Py.mjs +0 -8
- package/.output/server/chunks/build/error-404-styles.BeWfK6Py.mjs.map +0 -1
- package/.output/server/chunks/build/error-500-DxFsom1i.mjs.map +0 -1
- package/.output/server/chunks/build/error-500-styles.CPUUvoY-.mjs +0 -8
- package/.output/server/chunks/build/error-500-styles.CPUUvoY-.mjs.map +0 -1
- package/.output/server/chunks/build/index-BB-Clavm.mjs.map +0 -1
- package/.output/server/node_modules/debug/package.json +0 -64
- package/.output/server/node_modules/debug/src/browser.js +0 -272
- package/.output/server/node_modules/debug/src/common.js +0 -292
- package/.output/server/node_modules/debug/src/index.js +0 -10
- package/.output/server/node_modules/debug/src/node.js +0 -263
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/crypto_callbacks.js +0 -81
- package/.output/server/node_modules/mongodb/lib/resource_management.js +0 -58
- package/.output/server/node_modules/mongoose/lib/browserDocument.js +0 -101
- package/.output/server/node_modules/mongoose/lib/documentProvider.js +0 -30
- package/.output/server/node_modules/mongoose/lib/helpers/createJSONSchemaTypeDefinition.js +0 -24
- package/.output/server/node_modules/mongoose/lib/helpers/promiseOrCallback.js +0 -54
- package/.output/server/node_modules/mongoose/lib/plugins/validateBeforeSave.js +0 -51
- package/.output/server/node_modules/supports-color/index.js +0 -202
- package/.output/server/node_modules/supports-color/package.json +0 -64
|
@@ -39,7 +39,7 @@ require('./helpers/printJestWarning');
|
|
|
39
39
|
|
|
40
40
|
const objectIdHexRegexp = /^[0-9A-Fa-f]{24}$/;
|
|
41
41
|
|
|
42
|
-
const { AsyncLocalStorage } = require('
|
|
42
|
+
const { AsyncLocalStorage } = require('async_hooks');
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Mongoose constructor.
|
|
@@ -56,7 +56,7 @@ const { AsyncLocalStorage } = require('node:async_hooks');
|
|
|
56
56
|
* const m = new mongoose.Mongoose();
|
|
57
57
|
*
|
|
58
58
|
* @api public
|
|
59
|
-
* @param {
|
|
59
|
+
* @param {object} options see [`Mongoose#set()` docs](https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.set())
|
|
60
60
|
*/
|
|
61
61
|
function Mongoose(options) {
|
|
62
62
|
this.connections = [];
|
|
@@ -82,7 +82,7 @@ function Mongoose(options) {
|
|
|
82
82
|
|
|
83
83
|
// If a user creates their own Mongoose instance, give them a separate copy
|
|
84
84
|
// of the `Schema` constructor so they get separate custom types. (gh-6933)
|
|
85
|
-
if (!options
|
|
85
|
+
if (!options?.[defaultMongooseSymbol]) {
|
|
86
86
|
const _this = this;
|
|
87
87
|
this.Schema = function() {
|
|
88
88
|
this.base = _this;
|
|
@@ -206,8 +206,8 @@ Mongoose.prototype.setDriver = function setDriver(driver) {
|
|
|
206
206
|
/**
|
|
207
207
|
* Sets mongoose options
|
|
208
208
|
*
|
|
209
|
-
* `key` can be used
|
|
210
|
-
* If
|
|
209
|
+
* `key` can be used as an object to set multiple options at once.
|
|
210
|
+
* If an error gets thrown for one option, other options will still be evaluated.
|
|
211
211
|
*
|
|
212
212
|
* #### Example:
|
|
213
213
|
*
|
|
@@ -228,30 +228,40 @@ Mongoose.prototype.setDriver = function setDriver(driver) {
|
|
|
228
228
|
* - `bufferCommands`: enable/disable mongoose's buffering mechanism for all connections and models
|
|
229
229
|
* - `bufferTimeoutMS`: If bufferCommands is on, this option sets the maximum amount of time Mongoose buffering will wait before throwing an error. If not specified, Mongoose will use 10000 (10 seconds).
|
|
230
230
|
* - `cloneSchemas`: `false` by default. Set to `true` to `clone()` all schemas before compiling into a model.
|
|
231
|
-
* - `debug`: If `true`, prints the operations mongoose sends to MongoDB to the console. If a writable stream is passed, it will log to that stream, without colorization. If a callback function is passed, it will receive the collection name, the method name, then all arguments passed to the method. For example, if you wanted to replicate the default logging, you could output from the callback `Mongoose: ${collectionName}.${methodName}(${methodArgs.join(', ')})`.
|
|
231
|
+
* - `debug`: If `true`, prints the operations mongoose sends to MongoDB to the console. If an object is passed, you can set `color`, `shell`, and `timestamp` options. If `timestamp` is `true`, Mongoose prefixes console debug output with an ISO timestamp in brackets. If a writable stream is passed, it will log to that stream, without colorization. If a callback function is passed, it will receive the collection name, the method name, then all arguments passed to the method. For example, if you wanted to replicate the default logging, you could output from the callback `Mongoose: ${collectionName}.${methodName}(${methodArgs.join(', ')})`.
|
|
232
232
|
* - `id`: If `true`, adds a `id` virtual to all schemas unless overwritten on a per-schema basis.
|
|
233
|
-
* - `timestamps.createdAt.immutable`: `true` by default. If `false`, it will change the `createdAt` field to be [`immutable: false`](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.immutable) which means you can update the `createdAt`
|
|
234
233
|
* - `maxTimeMS`: If set, attaches [maxTimeMS](https://www.mongodb.com/docs/manual/reference/operator/meta/maxTimeMS/) to every query
|
|
235
234
|
* - `objectIdGetter`: `true` by default. Mongoose adds a getter to MongoDB ObjectId's called `_id` that returns `this` for convenience with populate. Set this to false to remove the getter.
|
|
236
235
|
* - `overwriteModels`: Set to `true` to default to overwriting models with the same name when calling `mongoose.model()`, as opposed to throwing an `OverwriteModelError`.
|
|
237
|
-
* - `
|
|
236
|
+
* - `returnDocument`: Set to `'before'` or `'after'` to set the default value for the `returnDocument` option to `findOneAndUpdate()`, `findByIdAndUpdate()`, and `findOneAndReplace()`. Defaults to `'before'`, which returns the document before the update was applied. Read our [`findOneAndUpdate()` tutorial](https://mongoosejs.com/docs/tutorials/findoneandupdate.html) for more information.
|
|
237
|
+
* - `returnOriginal`: **Deprecated.** Use `returnDocument` instead. If `false`, changes the default `returnOriginal` option to `findOneAndUpdate()`, `findByIdAndUpdate`, and `findOneAndReplace()` to false. This is equivalent to setting the `new` option to `true` for `findOneAndX()` calls by default. Read our [`findOneAndUpdate()` tutorial](https://mongoosejs.com/docs/tutorials/findoneandupdate.html) for more information.
|
|
238
238
|
* - `runValidators`: `false` by default. Set to true to enable [update validators](https://mongoosejs.com/docs/validation.html#update-validators) for all validators by default.
|
|
239
239
|
* - `sanitizeFilter`: `false` by default. Set to true to enable the [sanitization of the query filters](https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.sanitizeFilter()) against query selector injection attacks by wrapping any nested objects that have a property whose name starts with `$` in a `$eq`.
|
|
240
240
|
* - `selectPopulatedPaths`: `true` by default. Set to false to opt out of Mongoose adding all fields that you `populate()` to your `select()`. The schema-level option `selectPopulatedPaths` overwrites this one.
|
|
241
|
-
* - `strict`: `true` by default, may be `false`, `true`, or `'throw'`. Sets the default strict mode for schemas.
|
|
242
241
|
* - `strictQuery`: `false` by default. May be `false`, `true`, or `'throw'`. Sets the default [strictQuery](https://mongoosejs.com/docs/guide.html#strictQuery) mode for schemas.
|
|
242
|
+
* - `strict`: `true` by default, may be `false`, `true`, or `'throw'`. Sets the default strict mode for schemas.
|
|
243
|
+
* - `timestamps.createdAt.immutable`: `true` by default. If `false`, it will change the `createdAt` field to be [`immutable: false`](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.immutable) which means you can update the `createdAt`
|
|
243
244
|
* - `toJSON`: `{ transform: true, flattenDecimals: true }` by default. Overwrites default objects to [`toJSON()`](https://mongoosejs.com/docs/api/document.html#Document.prototype.toJSON()), for determining how Mongoose documents get serialized by `JSON.stringify()`
|
|
244
245
|
* - `toObject`: `{ transform: true, flattenDecimals: true }` by default. Overwrites default objects to [`toObject()`](https://mongoosejs.com/docs/api/document.html#Document.prototype.toObject())
|
|
246
|
+
* - `transactionAsyncLocalStorage`: `false` by default. If `true`, Mongoose will automatically pass the `session` to any operation executing within a transaction executor function. See [transaction AsyncLocalStorage documentation](https://mongoosejs.com/docs/transactions.html#asynclocalstorage)
|
|
247
|
+
* - `translateAliases`: `false` by default. If `true`, Mongoose will automatically translate aliases to their original paths before sending the query to MongoDB.
|
|
248
|
+
* - `updatePipeline`: `false` by default. If `true`, allows passing update pipelines (arrays) to update operations by default without explicitly setting `updatePipeline: true` in each query.
|
|
245
249
|
*
|
|
246
|
-
* @param {
|
|
247
|
-
* @param {
|
|
248
|
-
* @returns {Mongoose} The used Mongoose
|
|
250
|
+
* @param {string|object} key The name of the option or an object of multiple key-value pairs
|
|
251
|
+
* @param {string|Function|boolean} value The value of the option, unused if "key" is an object
|
|
252
|
+
* @returns {Mongoose} The used Mongoose instance
|
|
249
253
|
* @api public
|
|
250
254
|
*/
|
|
251
255
|
|
|
252
256
|
Mongoose.prototype.set = function getsetOptions(key, value) {
|
|
253
257
|
const _mongoose = this instanceof Mongoose ? this : mongoose;
|
|
254
258
|
|
|
259
|
+
if (key == null) {
|
|
260
|
+
const error = new SetOptionError();
|
|
261
|
+
error.addError(String(key), new SetOptionError.SetOptionInnerError(String(key)));
|
|
262
|
+
throw error;
|
|
263
|
+
}
|
|
264
|
+
|
|
255
265
|
if (arguments.length === 1 && typeof key !== 'object') {
|
|
256
266
|
if (VALID_OPTIONS.indexOf(key) === -1) {
|
|
257
267
|
const error = new SetOptionError();
|
|
@@ -307,11 +317,28 @@ Mongoose.prototype.set = function getsetOptions(key, value) {
|
|
|
307
317
|
} else if (optionKey === 'createInitialConnection') {
|
|
308
318
|
if (optionValue && !_mongoose.connection) {
|
|
309
319
|
_createDefaultConnection(_mongoose);
|
|
310
|
-
} else if (optionValue === false && _mongoose.connection
|
|
311
|
-
if (_mongoose.connection.readyState === STATES.disconnected &&
|
|
320
|
+
} else if (optionValue === false && _mongoose.connection?.[defaultConnectionSymbol]) {
|
|
321
|
+
if (_mongoose.connection.readyState === STATES.disconnected && utils.hasOwnKeys(_mongoose.connection.models) === false) {
|
|
312
322
|
_mongoose.connections.shift();
|
|
313
323
|
}
|
|
314
324
|
}
|
|
325
|
+
} else if (optionKey === 'returnOriginal') {
|
|
326
|
+
if (_mongoose.options.returnDocument != null) {
|
|
327
|
+
throw new MongooseError(
|
|
328
|
+
'Cannot set `returnOriginal` when `returnDocument` is already set. Use `returnDocument` instead.'
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
const replacement = optionValue === true ? '\'before\'' : '\'after\'';
|
|
332
|
+
utils.warn(
|
|
333
|
+
'Mongoose: the `returnOriginal` option for `mongoose.set()` is deprecated. ' +
|
|
334
|
+
'Use `mongoose.set(\'returnDocument\', ' + replacement + ')` instead.'
|
|
335
|
+
);
|
|
336
|
+
} else if (optionKey === 'returnDocument') {
|
|
337
|
+
if (_mongoose.options.returnOriginal != null) {
|
|
338
|
+
throw new MongooseError(
|
|
339
|
+
'Cannot set `returnDocument` when `returnOriginal` is already set. Use `returnDocument` instead of `returnOriginal`.'
|
|
340
|
+
);
|
|
341
|
+
}
|
|
315
342
|
}
|
|
316
343
|
}
|
|
317
344
|
|
|
@@ -329,7 +356,7 @@ Mongoose.prototype.set = function getsetOptions(key, value) {
|
|
|
329
356
|
*
|
|
330
357
|
* mongoose.get('test') // returns the 'test' value
|
|
331
358
|
*
|
|
332
|
-
* @param {
|
|
359
|
+
* @param {string} key
|
|
333
360
|
* @method get
|
|
334
361
|
* @api public
|
|
335
362
|
*/
|
|
@@ -364,18 +391,17 @@ Mongoose.prototype.get = Mongoose.prototype.set;
|
|
|
364
391
|
* db = mongoose.createConnection();
|
|
365
392
|
* await db.openUri('mongodb://127.0.0.1:27017/database');
|
|
366
393
|
*
|
|
367
|
-
* @param {
|
|
368
|
-
* @param {
|
|
369
|
-
* @param {
|
|
370
|
-
* @param {
|
|
371
|
-
* @param {
|
|
372
|
-
* @param {
|
|
373
|
-
* @param {
|
|
374
|
-
* @param {
|
|
375
|
-
* @param {
|
|
376
|
-
* @param {
|
|
377
|
-
* @param {
|
|
378
|
-
* @param {Number} [options.family=0] Passed transparently to [Node.js' `dns.lookup()`](https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback) function. May be either `0`, `4`, or `6`. `4` means use IPv4 only, `6` means use IPv6 only, `0` means try both.
|
|
394
|
+
* @param {string} uri mongodb URI to connect to
|
|
395
|
+
* @param {object} [options] passed down to the [MongoDB driver's `connect()` function](https://mongodb.github.io/node-mongodb-native/7.0/interfaces/MongoClientOptions.html), except for 4 mongoose-specific options explained below.
|
|
396
|
+
* @param {boolean} [options.bufferCommands=true] Mongoose specific option. Set to false to [disable buffering](https://mongoosejs.com/docs/faq.html#callback_never_executes) on all models associated with this connection.
|
|
397
|
+
* @param {string} [options.dbName] The name of the database you want to use. If not provided, Mongoose uses the database name from connection string.
|
|
398
|
+
* @param {string} [options.user] username for authentication, equivalent to `options.auth.username`. Maintained for backwards compatibility.
|
|
399
|
+
* @param {string} [options.pass] password for authentication, equivalent to `options.auth.password`. Maintained for backwards compatibility.
|
|
400
|
+
* @param {boolean} [options.autoIndex=true] Mongoose-specific option. Set to false to disable automatic index creation for all models associated with this connection.
|
|
401
|
+
* @param {number} [options.maxPoolSize=100] The maximum number of sockets the MongoDB driver will keep open for this connection. Keep in mind that MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](https://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
|
|
402
|
+
* @param {number} [options.minPoolSize=0] The minimum number of sockets the MongoDB driver will keep open for this connection. Keep in mind that MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](https://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
|
|
403
|
+
* @param {number} [options.socketTimeoutMS=0] How long the MongoDB driver will wait before killing a socket due to inactivity _after initial connection_. Defaults to 0, which means Node.js will not time out the socket due to inactivity. A socket may be inactive because of either no activity or a long-running operation. This option is passed to [Node.js `socket#setTimeout()` function](https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback) after the MongoDB driver successfully completes.
|
|
404
|
+
* @param {number} [options.family=0] Passed transparently to [Node.js' `dns.lookup()`](https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback) function. May be either `0`, `4`, or `6`. `4` means use IPv4 only, `6` means use IPv6 only, `0` means try both.
|
|
379
405
|
* @return {Connection} the created Connection object. Connections are not thenable, so you can't do `await mongoose.createConnection()`. To await use `mongoose.createConnection(uri).asPromise()` instead.
|
|
380
406
|
* @api public
|
|
381
407
|
*/
|
|
@@ -415,22 +441,21 @@ Mongoose.prototype.createConnection = function createConnection(uri, options) {
|
|
|
415
441
|
* const uri = 'mongodb://nonexistent.domain:27000';
|
|
416
442
|
* await mongoose.connect(uri);
|
|
417
443
|
*
|
|
418
|
-
* @param {
|
|
419
|
-
* @param {
|
|
420
|
-
* @param {
|
|
421
|
-
* @param {
|
|
422
|
-
* @param {
|
|
423
|
-
* @param {
|
|
424
|
-
* @param {
|
|
425
|
-
* @param {
|
|
426
|
-
* @param {
|
|
427
|
-
* @param {
|
|
428
|
-
* @param {
|
|
429
|
-
* @param {
|
|
430
|
-
* @param {
|
|
431
|
-
* @param {
|
|
432
|
-
* @param {
|
|
433
|
-
* @param {Boolean} [options.autoCreate=false] Set to `true` to make Mongoose automatically call `createCollection()` on every model created on this connection.
|
|
444
|
+
* @param {string} uri mongodb URI to connect to
|
|
445
|
+
* @param {object} [options] passed down to the [MongoDB driver's `connect()` function](https://mongodb.github.io/node-mongodb-native/7.0/interfaces/MongoClientOptions.html), except for 4 mongoose-specific options explained below.
|
|
446
|
+
* @param {boolean} [options.bufferCommands=true] Mongoose specific option. Set to false to [disable buffering](https://mongoosejs.com/docs/faq.html#callback_never_executes) on all models associated with this connection.
|
|
447
|
+
* @param {number} [options.bufferTimeoutMS=10000] Mongoose specific option. If `bufferCommands` is true, Mongoose will throw an error after `bufferTimeoutMS` if the operation is still buffered.
|
|
448
|
+
* @param {string} [options.dbName] The name of the database we want to use. If not provided, use database name from connection string.
|
|
449
|
+
* @param {string} [options.user] username for authentication, equivalent to `options.auth.username`. Maintained for backwards compatibility.
|
|
450
|
+
* @param {string} [options.pass] password for authentication, equivalent to `options.auth.password`. Maintained for backwards compatibility.
|
|
451
|
+
* @param {number} [options.maxPoolSize=100] The maximum number of sockets the MongoDB driver will keep open for this connection. Keep in mind that MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](https://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
|
|
452
|
+
* @param {number} [options.minPoolSize=0] The minimum number of sockets the MongoDB driver will keep open for this connection.
|
|
453
|
+
* @param {number} [options.serverSelectionTimeoutMS] If `useUnifiedTopology = true`, the MongoDB driver will try to find a server to send any given operation to, and keep retrying for `serverSelectionTimeoutMS` milliseconds before erroring out. If not set, the MongoDB driver defaults to using `30000` (30 seconds).
|
|
454
|
+
* @param {number} [options.heartbeatFrequencyMS] If `useUnifiedTopology = true`, the MongoDB driver sends a heartbeat every `heartbeatFrequencyMS` to check on the status of the connection. A heartbeat is subject to `serverSelectionTimeoutMS`, so the MongoDB driver will retry failed heartbeats for up to 30 seconds by default. Mongoose only emits a `'disconnected'` event after a heartbeat has failed, so you may want to decrease this setting to reduce the time between when your server goes down and when Mongoose emits `'disconnected'`. We recommend you do **not** set this setting below 1000, too many heartbeats can lead to performance degradation.
|
|
455
|
+
* @param {boolean} [options.autoIndex=true] Mongoose-specific option. Set to false to disable automatic index creation for all models associated with this connection.
|
|
456
|
+
* @param {number} [options.socketTimeoutMS=0] How long the MongoDB driver will wait before killing a socket due to inactivity _after initial connection_. A socket may be inactive because of either no activity or a long-running operation. `socketTimeoutMS` defaults to 0, which means Node.js will not time out the socket due to inactivity. This option is passed to [Node.js `socket#setTimeout()` function](https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback) after the MongoDB driver successfully completes.
|
|
457
|
+
* @param {number} [options.family=0] Passed transparently to [Node.js' `dns.lookup()`](https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback) function. May be either `0`, `4`, or `6`. `4` means use IPv4 only, `6` means use IPv6 only, `0` means try both.
|
|
458
|
+
* @param {boolean} [options.autoCreate=false] Set to `true` to make Mongoose automatically call `createCollection()` on every model created on this connection.
|
|
434
459
|
* @see Mongoose#createConnection https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.createConnection()
|
|
435
460
|
* @api public
|
|
436
461
|
* @return {Promise} resolves to `this` if connection succeeded
|
|
@@ -480,8 +505,8 @@ Mongoose.prototype.disconnect = async function disconnect() {
|
|
|
480
505
|
* Sessions are scoped to a connection, so calling `mongoose.startSession()`
|
|
481
506
|
* starts a session on the [default mongoose connection](https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.connection).
|
|
482
507
|
*
|
|
483
|
-
* @param {
|
|
484
|
-
* @param {
|
|
508
|
+
* @param {object} [options] see the [mongodb driver options](https://mongodb.github.io/node-mongodb-native/7.0/classes/MongoClient.html#startSession)
|
|
509
|
+
* @param {boolean} [options.causalConsistency=true] set to false to disable causal consistency
|
|
485
510
|
* @return {Promise<ClientSession>} promise that resolves to a MongoDB driver `ClientSession`
|
|
486
511
|
* @api public
|
|
487
512
|
*/
|
|
@@ -554,11 +579,11 @@ Mongoose.prototype.pluralize = function pluralize(fn) {
|
|
|
554
579
|
* const collectionName = 'actor';
|
|
555
580
|
* const M = mongoose.model('Actor', schema, collectionName);
|
|
556
581
|
*
|
|
557
|
-
* @param {
|
|
582
|
+
* @param {string|Function} name model name or class extending Model
|
|
558
583
|
* @param {Schema} [schema] the schema to use.
|
|
559
|
-
* @param {
|
|
560
|
-
* @param {
|
|
561
|
-
* @param {
|
|
584
|
+
* @param {string} [collection] name (optional, inferred from model name)
|
|
585
|
+
* @param {object} [options]
|
|
586
|
+
* @param {boolean} [options.overwriteModels=false] If true, overwrite existing models with the same name to avoid `OverwriteModelError`
|
|
562
587
|
* @return {Model} The model associated with `name`. Mongoose will create the model if it doesn't already exist.
|
|
563
588
|
* @api public
|
|
564
589
|
*/
|
|
@@ -704,7 +729,7 @@ Mongoose.prototype._model = function _model(name, schema, collection, options) {
|
|
|
704
729
|
* });
|
|
705
730
|
*
|
|
706
731
|
* @api public
|
|
707
|
-
* @param {
|
|
732
|
+
* @param {string|RegExp} name if string, the name of the model to remove. If regexp, removes all models whose name matches the regexp.
|
|
708
733
|
* @return {Mongoose} this
|
|
709
734
|
*/
|
|
710
735
|
|
|
@@ -745,8 +770,8 @@ Mongoose.prototype._applyPlugins = function _applyPlugins(schema, options) {
|
|
|
745
770
|
const _mongoose = this instanceof Mongoose ? this : mongoose;
|
|
746
771
|
|
|
747
772
|
options = options || {};
|
|
748
|
-
options.applyPluginsToDiscriminators = _mongoose.options
|
|
749
|
-
options.applyPluginsToChildSchemas = typeof
|
|
773
|
+
options.applyPluginsToDiscriminators = _mongoose.options?.applyPluginsToDiscriminators || false;
|
|
774
|
+
options.applyPluginsToChildSchemas = typeof _mongoose.options?.applyPluginsToChildSchemas === 'boolean' ?
|
|
750
775
|
_mongoose.options.applyPluginsToChildSchemas :
|
|
751
776
|
true;
|
|
752
777
|
applyPlugins(schema, _mongoose.plugins, options, '$globalPluginsApplied');
|
|
@@ -758,7 +783,7 @@ Mongoose.prototype._applyPlugins = function _applyPlugins(schema, options) {
|
|
|
758
783
|
* Equivalent to calling `.plugin(fn)` on each Schema you create.
|
|
759
784
|
*
|
|
760
785
|
* @param {Function} fn plugin callback
|
|
761
|
-
* @param {
|
|
786
|
+
* @param {object} [opts] optional options
|
|
762
787
|
* @return {Mongoose} this
|
|
763
788
|
* @see plugins https://mongoosejs.com/docs/plugins.html
|
|
764
789
|
* @api public
|
|
@@ -839,7 +864,7 @@ Mongoose.prototype.connections;
|
|
|
839
864
|
*
|
|
840
865
|
* @memberOf Mongoose
|
|
841
866
|
* @instance
|
|
842
|
-
* @property {
|
|
867
|
+
* @property {number} nextConnectionId
|
|
843
868
|
* @api private
|
|
844
869
|
*/
|
|
845
870
|
|
|
@@ -1005,7 +1030,7 @@ Mongoose.prototype.VirtualType = VirtualType;
|
|
|
1005
1030
|
* - [Array](https://mongoosejs.com/docs/schematypes.html#arrays)
|
|
1006
1031
|
* - [Buffer](https://mongoosejs.com/docs/schematypes.html#buffers)
|
|
1007
1032
|
* - [Embedded](https://mongoosejs.com/docs/schematypes.html#schemas)
|
|
1008
|
-
* - [DocumentArray](https://mongoosejs.com/docs/api/
|
|
1033
|
+
* - [DocumentArray](https://mongoosejs.com/docs/api/documentarray.html)
|
|
1009
1034
|
* - [Decimal128](https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.Decimal128)
|
|
1010
1035
|
* - [ObjectId](https://mongoosejs.com/docs/schematypes.html#objectids)
|
|
1011
1036
|
* - [Map](https://mongoosejs.com/docs/schematypes.html#maps)
|
|
@@ -1050,16 +1075,6 @@ Mongoose.prototype.Model = Model;
|
|
|
1050
1075
|
|
|
1051
1076
|
Mongoose.prototype.Document = Document;
|
|
1052
1077
|
|
|
1053
|
-
/**
|
|
1054
|
-
* The Mongoose DocumentProvider constructor. Mongoose users should not have to
|
|
1055
|
-
* use this directly
|
|
1056
|
-
*
|
|
1057
|
-
* @method DocumentProvider
|
|
1058
|
-
* @api public
|
|
1059
|
-
*/
|
|
1060
|
-
|
|
1061
|
-
Mongoose.prototype.DocumentProvider = require('./documentProvider');
|
|
1062
|
-
|
|
1063
1078
|
/**
|
|
1064
1079
|
* The Mongoose ObjectId [SchemaType](https://mongoosejs.com/docs/schematypes.html). Used for
|
|
1065
1080
|
* declaring paths in your schema that should be
|
|
@@ -1091,7 +1106,7 @@ Mongoose.prototype.ObjectId = SchemaTypes.ObjectId;
|
|
|
1091
1106
|
* mongoose.isValidObjectId({ test: 42 }); // false
|
|
1092
1107
|
*
|
|
1093
1108
|
* @method isValidObjectId
|
|
1094
|
-
* @param {
|
|
1109
|
+
* @param {any} v
|
|
1095
1110
|
* @returns {boolean} true if `v` is something Mongoose can coerce to an ObjectId
|
|
1096
1111
|
* @api public
|
|
1097
1112
|
*/
|
|
@@ -1123,7 +1138,7 @@ Mongoose.prototype.isValidObjectId = function isValidObjectId(v) {
|
|
|
1123
1138
|
* mongoose.isObjectIdOrHexString({ test: 42 }); // false
|
|
1124
1139
|
*
|
|
1125
1140
|
* @method isObjectIdOrHexString
|
|
1126
|
-
* @param {
|
|
1141
|
+
* @param {any} v
|
|
1127
1142
|
* @returns {boolean} true if `v` is an ObjectId instance _or_ a 24 char hex string
|
|
1128
1143
|
* @api public
|
|
1129
1144
|
*/
|
|
@@ -1136,8 +1151,8 @@ Mongoose.prototype.isObjectIdOrHexString = function isObjectIdOrHexString(v) {
|
|
|
1136
1151
|
*
|
|
1137
1152
|
* Syncs all the indexes for the models registered with this connection.
|
|
1138
1153
|
*
|
|
1139
|
-
* @param {
|
|
1140
|
-
* @param {
|
|
1154
|
+
* @param {object} options
|
|
1155
|
+
* @param {boolean} options.continueOnError `false` by default. If set to `true`, mongoose will not throw an error if one model syncing failed, and will return an object where the keys are the names of the models, and the values are the results/errors for each model.
|
|
1141
1156
|
* @return {Promise} Returns a Promise, when the Promise resolves the value is a list of the dropped indexes.
|
|
1142
1157
|
*/
|
|
1143
1158
|
Mongoose.prototype.syncIndexes = function syncIndexes(options) {
|
|
@@ -1224,7 +1239,7 @@ Mongoose.prototype.MongooseError = MongooseError;
|
|
|
1224
1239
|
* using a tool like [Sinon](https://www.npmjs.com/package/sinon) for testing.
|
|
1225
1240
|
*
|
|
1226
1241
|
* @method now
|
|
1227
|
-
* @returns Date the current time
|
|
1242
|
+
* @returns {Date} the current time
|
|
1228
1243
|
* @api public
|
|
1229
1244
|
*/
|
|
1230
1245
|
|
|
@@ -1234,9 +1249,9 @@ Mongoose.prototype.now = function now() { return new Date(); };
|
|
|
1234
1249
|
* The Mongoose CastError constructor
|
|
1235
1250
|
*
|
|
1236
1251
|
* @method CastError
|
|
1237
|
-
* @param {
|
|
1238
|
-
* @param {
|
|
1239
|
-
* @param {
|
|
1252
|
+
* @param {string} type The name of the type
|
|
1253
|
+
* @param {any} value The value that failed to cast
|
|
1254
|
+
* @param {string} path The path `a.b.c` in the doc where this cast error occurred
|
|
1240
1255
|
* @param {Error} [reason] The original error that was thrown
|
|
1241
1256
|
* @api public
|
|
1242
1257
|
*/
|
|
@@ -1272,8 +1287,8 @@ Mongoose.prototype.mquery = require('mquery');
|
|
|
1272
1287
|
* ```
|
|
1273
1288
|
*
|
|
1274
1289
|
* @method sanitizeFilter
|
|
1275
|
-
* @param {
|
|
1276
|
-
* @returns
|
|
1290
|
+
* @param {object} filter
|
|
1291
|
+
* @returns {object} the sanitized object
|
|
1277
1292
|
* @api public
|
|
1278
1293
|
*/
|
|
1279
1294
|
|
|
@@ -1292,8 +1307,8 @@ Mongoose.prototype.sanitizeFilter = sanitizeFilter;
|
|
|
1292
1307
|
* ```
|
|
1293
1308
|
*
|
|
1294
1309
|
* @method trusted
|
|
1295
|
-
* @param {
|
|
1296
|
-
* @returns
|
|
1310
|
+
* @param {object} obj
|
|
1311
|
+
* @returns {object} the passed in object
|
|
1297
1312
|
* @api public
|
|
1298
1313
|
*/
|
|
1299
1314
|
|
|
@@ -1336,6 +1351,43 @@ Mongoose.prototype.skipMiddlewareFunction = Kareem.skipWrappedFunction;
|
|
|
1336
1351
|
|
|
1337
1352
|
Mongoose.prototype.overwriteMiddlewareResult = Kareem.overwriteResult;
|
|
1338
1353
|
|
|
1354
|
+
/**
|
|
1355
|
+
* Use this function in `pre()` middleware to replace the arguments passed to the next middleware or hook.
|
|
1356
|
+
*
|
|
1357
|
+
* #### Example:
|
|
1358
|
+
*
|
|
1359
|
+
* // Suppose you have a schema for time in "HH:MM" string format, but you want to store it as an object { hours, minutes }
|
|
1360
|
+
* const timeStringToObject = (time) => {
|
|
1361
|
+
* if (typeof time !== 'string') return time;
|
|
1362
|
+
* const [hours, minutes] = time.split(':');
|
|
1363
|
+
* return { hours: parseInt(hours), minutes: parseInt(minutes) };
|
|
1364
|
+
* };
|
|
1365
|
+
*
|
|
1366
|
+
* const timeSchema = new Schema({
|
|
1367
|
+
* hours: { type: Number, required: true },
|
|
1368
|
+
* minutes: { type: Number, required: true },
|
|
1369
|
+
* });
|
|
1370
|
+
*
|
|
1371
|
+
* // In a pre('init') hook, replace raw string doc with custom object form
|
|
1372
|
+
* timeSchema.pre('init', function(doc) {
|
|
1373
|
+
* if (typeof doc === 'string') {
|
|
1374
|
+
* return mongoose.overwriteMiddlewareArguments(timeStringToObject(doc));
|
|
1375
|
+
* }
|
|
1376
|
+
* });
|
|
1377
|
+
*
|
|
1378
|
+
* // Now, initializing with a time string gets auto-converted by the hook
|
|
1379
|
+
* const userSchema = new Schema({ time: timeSchema });
|
|
1380
|
+
* const User = mongoose.model('User', userSchema);
|
|
1381
|
+
* const doc = new User({});
|
|
1382
|
+
* doc.$init({ time: '12:30' });
|
|
1383
|
+
*
|
|
1384
|
+
* @method overwriteMiddlewareArguments
|
|
1385
|
+
* @param {...any} args The new arguments to be passed to the next middleware. Pass multiple arguments as a spread, **not** as an array.
|
|
1386
|
+
* @api public
|
|
1387
|
+
*/
|
|
1388
|
+
|
|
1389
|
+
Mongoose.prototype.overwriteMiddlewareArguments = Kareem.overwriteArguments;
|
|
1390
|
+
|
|
1339
1391
|
/**
|
|
1340
1392
|
* Takes in an object and deletes any keys from the object whose values
|
|
1341
1393
|
* are strictly equal to `undefined`.
|
|
@@ -1351,8 +1403,8 @@ Mongoose.prototype.overwriteMiddlewareResult = Kareem.overwriteResult;
|
|
|
1351
1403
|
* await UserModel.findOne(mongoose.omitUndefined(filter));
|
|
1352
1404
|
*
|
|
1353
1405
|
* @method omitUndefined
|
|
1354
|
-
* @param {
|
|
1355
|
-
* @returns {
|
|
1406
|
+
* @param {object} [val] the object to remove undefined keys from
|
|
1407
|
+
* @returns {object} the object passed in
|
|
1356
1408
|
* @api public
|
|
1357
1409
|
*/
|
|
1358
1410
|
|
|
@@ -46,7 +46,7 @@ Object.defineProperty(SchemaArrayOptions.prototype, 'enum', opts);
|
|
|
46
46
|
* @api public
|
|
47
47
|
* @property of
|
|
48
48
|
* @memberOf SchemaArrayOptions
|
|
49
|
-
* @type {Function|
|
|
49
|
+
* @type {Function|string}
|
|
50
50
|
* @instance
|
|
51
51
|
*/
|
|
52
52
|
|
|
@@ -65,7 +65,7 @@ Object.defineProperty(SchemaArrayOptions.prototype, 'of', opts);
|
|
|
65
65
|
* @api public
|
|
66
66
|
* @property castNonArrays
|
|
67
67
|
* @memberOf SchemaArrayOptions
|
|
68
|
-
* @type {
|
|
68
|
+
* @type {boolean}
|
|
69
69
|
* @instance
|
|
70
70
|
*/
|
|
71
71
|
|
|
@@ -61,6 +61,29 @@ Object.defineProperty(SchemaDocumentArrayOptions.prototype, 'excludeIndexes', op
|
|
|
61
61
|
|
|
62
62
|
Object.defineProperty(SchemaDocumentArrayOptions.prototype, '_id', opts);
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Defines embedded discriminators for this document array path.
|
|
66
|
+
*
|
|
67
|
+
* #### Example:
|
|
68
|
+
*
|
|
69
|
+
* const eventSchema = Schema({ message: String }, { discriminatorKey: 'kind' });
|
|
70
|
+
* const clickedSchema = Schema({ element: String });
|
|
71
|
+
* const parentSchema = Schema({
|
|
72
|
+
* events: [{
|
|
73
|
+
* type: eventSchema,
|
|
74
|
+
* discriminators: { Clicked: clickedSchema }
|
|
75
|
+
* }]
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* @api public
|
|
79
|
+
* @property discriminators
|
|
80
|
+
* @memberOf SchemaDocumentArrayOptions
|
|
81
|
+
* @type {Object}
|
|
82
|
+
* @instance
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
Object.defineProperty(SchemaDocumentArrayOptions.prototype, 'discriminators', opts);
|
|
86
|
+
|
|
64
87
|
/*!
|
|
65
88
|
* ignore
|
|
66
89
|
*/
|
|
@@ -26,7 +26,7 @@ const opts = require('./propertyOptions');
|
|
|
26
26
|
* @api public
|
|
27
27
|
* @property min
|
|
28
28
|
* @memberOf SchemaNumberOptions
|
|
29
|
-
* @type {
|
|
29
|
+
* @type {number}
|
|
30
30
|
* @instance
|
|
31
31
|
*/
|
|
32
32
|
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(SchemaNumberOptions.prototype, 'min', opts);
|
|
|
39
39
|
* @api public
|
|
40
40
|
* @property max
|
|
41
41
|
* @memberOf SchemaNumberOptions
|
|
42
|
-
* @type {
|
|
42
|
+
* @type {number}
|
|
43
43
|
* @instance
|
|
44
44
|
*/
|
|
45
45
|
|
|
@@ -88,7 +88,7 @@ Object.defineProperty(SchemaNumberOptions.prototype, 'enum', opts);
|
|
|
88
88
|
* @api public
|
|
89
89
|
* @property populate
|
|
90
90
|
* @memberOf SchemaNumberOptions
|
|
91
|
-
* @type {
|
|
91
|
+
* @type {object}
|
|
92
92
|
* @instance
|
|
93
93
|
*/
|
|
94
94
|
|
|
@@ -25,7 +25,7 @@ const opts = require('./propertyOptions');
|
|
|
25
25
|
* @api public
|
|
26
26
|
* @property auto
|
|
27
27
|
* @memberOf SchemaObjectIdOptions
|
|
28
|
-
* @type {
|
|
28
|
+
* @type {boolean}
|
|
29
29
|
* @instance
|
|
30
30
|
*/
|
|
31
31
|
|
|
@@ -51,7 +51,7 @@ Object.defineProperty(SchemaObjectIdOptions.prototype, 'auto', opts);
|
|
|
51
51
|
* @api public
|
|
52
52
|
* @property populate
|
|
53
53
|
* @memberOf SchemaObjectIdOptions
|
|
54
|
-
* @type {
|
|
54
|
+
* @type {object}
|
|
55
55
|
* @instance
|
|
56
56
|
*/
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ Object.defineProperty(SchemaStringOptions.prototype, 'match', opts);
|
|
|
51
51
|
* @api public
|
|
52
52
|
* @property lowercase
|
|
53
53
|
* @memberOf SchemaStringOptions
|
|
54
|
-
* @type {
|
|
54
|
+
* @type {boolean}
|
|
55
55
|
* @instance
|
|
56
56
|
*/
|
|
57
57
|
|
|
@@ -64,7 +64,7 @@ Object.defineProperty(SchemaStringOptions.prototype, 'lowercase', opts);
|
|
|
64
64
|
* @api public
|
|
65
65
|
* @property trim
|
|
66
66
|
* @memberOf SchemaStringOptions
|
|
67
|
-
* @type {
|
|
67
|
+
* @type {boolean}
|
|
68
68
|
* @instance
|
|
69
69
|
*/
|
|
70
70
|
|
|
@@ -77,7 +77,7 @@ Object.defineProperty(SchemaStringOptions.prototype, 'trim', opts);
|
|
|
77
77
|
* @api public
|
|
78
78
|
* @property uppercase
|
|
79
79
|
* @memberOf SchemaStringOptions
|
|
80
|
-
* @type {
|
|
80
|
+
* @type {boolean}
|
|
81
81
|
* @instance
|
|
82
82
|
*/
|
|
83
83
|
|
|
@@ -94,7 +94,7 @@ Object.defineProperty(SchemaStringOptions.prototype, 'uppercase', opts);
|
|
|
94
94
|
* @api public
|
|
95
95
|
* @property minLength
|
|
96
96
|
* @memberOf SchemaStringOptions
|
|
97
|
-
* @type {
|
|
97
|
+
* @type {number}
|
|
98
98
|
* @instance
|
|
99
99
|
*/
|
|
100
100
|
|
|
@@ -112,7 +112,7 @@ Object.defineProperty(SchemaStringOptions.prototype, 'minlength', opts);
|
|
|
112
112
|
* @api public
|
|
113
113
|
* @property maxLength
|
|
114
114
|
* @memberOf SchemaStringOptions
|
|
115
|
-
* @type {
|
|
115
|
+
* @type {number}
|
|
116
116
|
* @instance
|
|
117
117
|
*/
|
|
118
118
|
|
|
@@ -125,7 +125,7 @@ Object.defineProperty(SchemaStringOptions.prototype, 'maxlength', opts);
|
|
|
125
125
|
* @api public
|
|
126
126
|
* @property populate
|
|
127
127
|
* @memberOf SchemaStringOptions
|
|
128
|
-
* @type {
|
|
128
|
+
* @type {object}
|
|
129
129
|
* @instance
|
|
130
130
|
*/
|
|
131
131
|
|
|
@@ -63,4 +63,27 @@ Object.defineProperty(SchemaSubdocumentOptions.prototype, '_id', opts);
|
|
|
63
63
|
|
|
64
64
|
Object.defineProperty(SchemaSubdocumentOptions.prototype, 'minimize', opts);
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Defines embedded discriminators for this single nested path.
|
|
68
|
+
*
|
|
69
|
+
* #### Example:
|
|
70
|
+
*
|
|
71
|
+
* const eventSchema = Schema({ message: String }, { discriminatorKey: 'kind' });
|
|
72
|
+
* const clickedSchema = Schema({ element: String });
|
|
73
|
+
* const parentSchema = Schema({
|
|
74
|
+
* event: {
|
|
75
|
+
* type: eventSchema,
|
|
76
|
+
* discriminators: { Clicked: clickedSchema }
|
|
77
|
+
* }
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* @api public
|
|
81
|
+
* @property discriminators
|
|
82
|
+
* @memberOf SchemaSubdocumentOptions
|
|
83
|
+
* @type {Object}
|
|
84
|
+
* @instance
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
Object.defineProperty(SchemaSubdocumentOptions.prototype, 'discriminators', opts);
|
|
88
|
+
|
|
66
89
|
module.exports = SchemaSubdocumentOptions;
|