@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const Mixed = require('../schema/mixed');
|
|
3
4
|
const MongooseError = require('../error/mongooseError');
|
|
4
5
|
const clone = require('../helpers/clone');
|
|
5
6
|
const deepEqual = require('../utils').deepEqual;
|
|
@@ -17,30 +18,14 @@ const populateModelSymbol = require('../helpers/symbols').populateModelSymbol;
|
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
class MongooseMap extends Map {
|
|
20
|
-
constructor(v, path, doc, schemaType
|
|
21
|
+
constructor(v, path, doc, schemaType) {
|
|
21
22
|
if (getConstructorName(v) === 'Object') {
|
|
22
23
|
v = Object.keys(v).reduce((arr, key) => arr.concat([[key, v[key]]]), []);
|
|
23
24
|
}
|
|
24
25
|
super(v);
|
|
25
|
-
this.$__parent = doc
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Priority: parent.$basePath (from subdoc) > options.path (from parent map/structure) > path (schema path)
|
|
29
|
-
// Subdocuments have the most up-to-date path info, so prefer that over options.path
|
|
30
|
-
if (this.$__parent?.$isSingleNested && this.$__parent.$basePath) {
|
|
31
|
-
this.$__path = this.$__parent.$basePath + '.' + path;
|
|
32
|
-
// Performance optimization: store path relative to parent subdocument
|
|
33
|
-
// to avoid string operations in set() hot path
|
|
34
|
-
this.$__pathRelativeToParent = path;
|
|
35
|
-
} else if (options?.path) {
|
|
36
|
-
this.$__path = options.path;
|
|
37
|
-
this.$__pathRelativeToParent = null;
|
|
38
|
-
} else {
|
|
39
|
-
this.$__path = path;
|
|
40
|
-
this.$__pathRelativeToParent = null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
this.$__schemaType = schemaType;
|
|
26
|
+
this.$__parent = doc?.$__ != null ? doc : null;
|
|
27
|
+
this.$__path = path;
|
|
28
|
+
this.$__schemaType = schemaType == null ? new Mixed(path) : schemaType;
|
|
44
29
|
|
|
45
30
|
this.$__runDeferred();
|
|
46
31
|
}
|
|
@@ -50,16 +35,8 @@ class MongooseMap extends Map {
|
|
|
50
35
|
|
|
51
36
|
super.set(key, value);
|
|
52
37
|
|
|
53
|
-
if (value
|
|
38
|
+
if (value?.$isSingleNested) {
|
|
54
39
|
value.$basePath = this.$__path + '.' + key;
|
|
55
|
-
// Store the path relative to parent subdoc for efficient markModified()
|
|
56
|
-
if (this.$__pathRelativeToParent != null) {
|
|
57
|
-
// Map's parent is a subdocument, store path relative to that subdoc
|
|
58
|
-
value.$pathRelativeToParent = this.$__pathRelativeToParent + '.' + key;
|
|
59
|
-
} else {
|
|
60
|
-
// Map's parent is root document, store the full path
|
|
61
|
-
value.$pathRelativeToParent = this.$__path + '.' + key;
|
|
62
|
-
}
|
|
63
40
|
}
|
|
64
41
|
}
|
|
65
42
|
|
|
@@ -129,7 +106,7 @@ class MongooseMap extends Map {
|
|
|
129
106
|
|
|
130
107
|
let _fullPath;
|
|
131
108
|
const parent = this.$__parent;
|
|
132
|
-
const populated = parent
|
|
109
|
+
const populated = parent?.$__?.populated ?
|
|
133
110
|
parent.$populated(fullPath.call(this), true) || parent.$populated(this.$__path, true) :
|
|
134
111
|
null;
|
|
135
112
|
const priorVal = this.get(key);
|
|
@@ -159,16 +136,9 @@ class MongooseMap extends Map {
|
|
|
159
136
|
}
|
|
160
137
|
} else {
|
|
161
138
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// For subdocuments, also pass the relative path to avoid string operations
|
|
166
|
-
if (this.$__schemaType.$isSingleNested) {
|
|
167
|
-
options.pathRelativeToParent = this.$__pathRelativeToParent != null ?
|
|
168
|
-
this.$__pathRelativeToParent + '.' + key :
|
|
169
|
-
this.$__path + '.' + key;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
139
|
+
const options = this.$__schemaType.$isMongooseDocumentArray || this.$__schemaType.$isSingleNested || this.$__schemaType.$isMongooseArray || this.$__schemaType.$isSchemaMap ?
|
|
140
|
+
{ path: fullPath.call(this) } :
|
|
141
|
+
null;
|
|
172
142
|
value = this.$__schemaType.applySetters(
|
|
173
143
|
value,
|
|
174
144
|
this.$__parent,
|
|
@@ -177,7 +147,7 @@ class MongooseMap extends Map {
|
|
|
177
147
|
options
|
|
178
148
|
);
|
|
179
149
|
} catch (error) {
|
|
180
|
-
if (this.$__parent
|
|
150
|
+
if (this.$__parent?.$__ != null) {
|
|
181
151
|
this.$__parent.invalidate(fullPath.call(this), error);
|
|
182
152
|
return;
|
|
183
153
|
}
|
|
@@ -187,34 +157,13 @@ class MongooseMap extends Map {
|
|
|
187
157
|
|
|
188
158
|
super.set(key, value);
|
|
189
159
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (this.$__pathRelativeToParent != null) {
|
|
194
|
-
// Map's parent is a subdocument, store path relative to that subdoc (e.g., 'items.i2')
|
|
195
|
-
value.$pathRelativeToParent = this.$__pathRelativeToParent + '.' + key;
|
|
196
|
-
} else {
|
|
197
|
-
// Map's parent is root document, store just the full path
|
|
198
|
-
value.$pathRelativeToParent = this.$__path + '.' + key;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (parent != null && parent.$__ != null && !deepEqual(value, priorVal)) {
|
|
203
|
-
// Optimization: if parent is a subdocument, use precalculated relative path
|
|
204
|
-
// to avoid building a full path just to strip the parent's prefix
|
|
205
|
-
let pathToMark;
|
|
206
|
-
if (this.$__pathRelativeToParent != null) {
|
|
207
|
-
// Parent is a subdocument - use precalculated relative path (e.g., 'items.i1')
|
|
208
|
-
pathToMark = this.$__pathRelativeToParent + '.' + key;
|
|
209
|
-
} else {
|
|
210
|
-
// Parent is root document or map - use full path
|
|
211
|
-
pathToMark = fullPath.call(this);
|
|
212
|
-
}
|
|
213
|
-
parent.markModified(pathToMark);
|
|
160
|
+
if (parent?.$__ != null && !deepEqual(value, priorVal)) {
|
|
161
|
+
const path = fullPath.call(this);
|
|
162
|
+
parent.markModified(path);
|
|
214
163
|
// If overwriting the full document array or subdoc, make sure to clean up any paths that were modified
|
|
215
164
|
// before re: #15108
|
|
216
165
|
if (this.$__schemaType.$isMongooseDocumentArray || this.$__schemaType.$isSingleNested) {
|
|
217
|
-
cleanModifiedSubpaths(parent,
|
|
166
|
+
cleanModifiedSubpaths(parent, path);
|
|
218
167
|
}
|
|
219
168
|
}
|
|
220
169
|
|
|
@@ -275,7 +224,7 @@ class MongooseMap extends Map {
|
|
|
275
224
|
}
|
|
276
225
|
|
|
277
226
|
toObject(options) {
|
|
278
|
-
if (options
|
|
227
|
+
if (options?.flattenMaps) {
|
|
279
228
|
const ret = {};
|
|
280
229
|
const keys = this.keys();
|
|
281
230
|
for (const key of keys) {
|
|
@@ -302,13 +251,13 @@ class MongooseMap extends Map {
|
|
|
302
251
|
*
|
|
303
252
|
* @api public
|
|
304
253
|
* @method toJSON
|
|
305
|
-
* @param {
|
|
306
|
-
* @param {
|
|
254
|
+
* @param {object} [options]
|
|
255
|
+
* @param {boolean} [options.flattenMaps=false] set to `true` to convert the map to a POJO rather than a native JavaScript map
|
|
307
256
|
* @memberOf Map
|
|
308
257
|
*/
|
|
309
258
|
|
|
310
259
|
toJSON(options) {
|
|
311
|
-
if (typeof
|
|
260
|
+
if (typeof options?.flattenMaps === 'boolean' ? options.flattenMaps : true) {
|
|
312
261
|
const ret = {};
|
|
313
262
|
const keys = this.keys();
|
|
314
263
|
for (const key of keys) {
|
|
@@ -396,7 +345,7 @@ Object.defineProperty(MongooseMap.prototype, '$__deferredCalls', {
|
|
|
396
345
|
/**
|
|
397
346
|
* Since maps are stored as objects under the hood, keys must be strings
|
|
398
347
|
* and can't contain any invalid characters
|
|
399
|
-
* @param {
|
|
348
|
+
* @param {string} key
|
|
400
349
|
* @api private
|
|
401
350
|
*/
|
|
402
351
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const Document = require('../document');
|
|
4
|
-
const immediate = require('../helpers/immediate');
|
|
5
4
|
const internalToObjectOptions = require('../options').internalToObjectOptions;
|
|
6
5
|
const util = require('util');
|
|
7
6
|
const utils = require('../utils');
|
|
@@ -15,11 +14,7 @@ module.exports = Subdocument;
|
|
|
15
14
|
* @api private
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
|
-
function Subdocument(value, fields, parent,
|
|
19
|
-
if (typeof skipId === 'object' && skipId != null && options == null) {
|
|
20
|
-
options = skipId;
|
|
21
|
-
skipId = undefined;
|
|
22
|
-
}
|
|
17
|
+
function Subdocument(value, fields, parent, options) {
|
|
23
18
|
if (parent != null) {
|
|
24
19
|
// If setting a nested path, should copy isNew from parent re: gh-7048
|
|
25
20
|
const parentOptions = { isNew: parent.isNew };
|
|
@@ -28,24 +23,10 @@ function Subdocument(value, fields, parent, skipId, options) {
|
|
|
28
23
|
}
|
|
29
24
|
options = Object.assign(parentOptions, options);
|
|
30
25
|
}
|
|
31
|
-
if (options
|
|
26
|
+
if (options?.path != null) {
|
|
32
27
|
this.$basePath = options.path;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
this.$pathRelativeToParent = options.pathRelativeToParent;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Don't pass `path` to Document constructor: path is used for storing the
|
|
39
|
-
// absolute path to this schematype relative to the top-level document, but
|
|
40
|
-
// subdocuments use relative paths (relative to the parent document) to track changes.
|
|
41
|
-
// This avoids the subdocument's fields receiving the subdocument's path as options.path.
|
|
42
|
-
let documentOptions = options;
|
|
43
|
-
if (options != null && options.path != null) {
|
|
44
|
-
documentOptions = Object.assign({}, options);
|
|
45
|
-
delete documentOptions.path;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Document.call(this, value, fields, skipId, documentOptions);
|
|
29
|
+
Document.call(this, value, fields, options);
|
|
49
30
|
|
|
50
31
|
delete this.$__.priorDoc;
|
|
51
32
|
}
|
|
@@ -79,7 +60,11 @@ Subdocument.prototype.toBSON = function() {
|
|
|
79
60
|
*
|
|
80
61
|
* _This is a no-op. Does not actually save the doc to the db._
|
|
81
62
|
*
|
|
82
|
-
* @param {
|
|
63
|
+
* @param {object} [options]
|
|
64
|
+
* @param {boolean} [options.suppressWarning=false] If `true`, suppress the warning about calling `save()` on a subdoc.
|
|
65
|
+
* @param {boolean|object} [options.middleware=true] set to `false` to skip all user-defined middleware
|
|
66
|
+
* @param {boolean} [options.middleware.pre=true] set to `false` to skip only pre hooks
|
|
67
|
+
* @param {boolean} [options.middleware.post=true] set to `false` to skip only post hooks
|
|
83
68
|
* @return {Promise} resolved Promise
|
|
84
69
|
* @api private
|
|
85
70
|
*/
|
|
@@ -94,24 +79,17 @@ Subdocument.prototype.save = async function save(options) {
|
|
|
94
79
|
'if you\'re sure this behavior is right for your app.');
|
|
95
80
|
}
|
|
96
81
|
|
|
97
|
-
return
|
|
98
|
-
this.$__save((err) => {
|
|
99
|
-
if (err != null) {
|
|
100
|
-
return reject(err);
|
|
101
|
-
}
|
|
102
|
-
resolve(this);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
82
|
+
return await this.$__save(options);
|
|
105
83
|
};
|
|
106
84
|
|
|
107
85
|
/**
|
|
108
86
|
* Given a path relative to this document, return the path relative
|
|
109
87
|
* to the top-level document.
|
|
110
|
-
* @param {
|
|
88
|
+
* @param {string} path
|
|
111
89
|
* @method $__fullPath
|
|
112
90
|
* @memberOf Subdocument
|
|
113
91
|
* @instance
|
|
114
|
-
* @returns {
|
|
92
|
+
* @returns {string}
|
|
115
93
|
* @api private
|
|
116
94
|
*/
|
|
117
95
|
|
|
@@ -128,8 +106,8 @@ Subdocument.prototype.$__fullPath = function(path) {
|
|
|
128
106
|
/**
|
|
129
107
|
* Given a path relative to this document, return the path relative
|
|
130
108
|
* to the parent document.
|
|
131
|
-
* @param {
|
|
132
|
-
* @returns {
|
|
109
|
+
* @param {string} p
|
|
110
|
+
* @returns {string}
|
|
133
111
|
* @method $__pathRelativeToParent
|
|
134
112
|
* @memberOf Subdocument
|
|
135
113
|
* @instance
|
|
@@ -137,12 +115,6 @@ Subdocument.prototype.$__fullPath = function(path) {
|
|
|
137
115
|
*/
|
|
138
116
|
|
|
139
117
|
Subdocument.prototype.$__pathRelativeToParent = function(p) {
|
|
140
|
-
// If this subdocument has a stored relative path (set by map when subdoc is created),
|
|
141
|
-
// use it directly to avoid string operations
|
|
142
|
-
if (this.$pathRelativeToParent != null) {
|
|
143
|
-
return p == null ? this.$pathRelativeToParent : this.$pathRelativeToParent + '.' + p;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
118
|
if (p == null) {
|
|
147
119
|
return this.$basePath;
|
|
148
120
|
}
|
|
@@ -164,8 +136,15 @@ Subdocument.prototype.$__pathRelativeToParent = function(p) {
|
|
|
164
136
|
* @api private
|
|
165
137
|
*/
|
|
166
138
|
|
|
167
|
-
Subdocument.prototype.$__save = function(
|
|
168
|
-
|
|
139
|
+
Subdocument.prototype.$__save = async function $__save(options) {
|
|
140
|
+
try {
|
|
141
|
+
await this._execDocumentPreHooks('save', options, [options]);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
await this._execDocumentPostHooks('save', options, error);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
await this._execDocumentPostHooks('save', options);
|
|
169
148
|
};
|
|
170
149
|
|
|
171
150
|
/*!
|
|
@@ -188,13 +167,9 @@ Subdocument.prototype.$isValid = function(path) {
|
|
|
188
167
|
Subdocument.prototype.markModified = function(path) {
|
|
189
168
|
Document.prototype.markModified.call(this, path);
|
|
190
169
|
const parent = this.$parent();
|
|
170
|
+
const fullPath = this.$__pathRelativeToParent(path);
|
|
191
171
|
|
|
192
|
-
if (parent == null) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const pathToMark = this.$__pathRelativeToParent(path);
|
|
197
|
-
if (pathToMark == null) {
|
|
172
|
+
if (parent == null || fullPath == null) {
|
|
198
173
|
return;
|
|
199
174
|
}
|
|
200
175
|
|
|
@@ -202,8 +177,7 @@ Subdocument.prototype.markModified = function(path) {
|
|
|
202
177
|
if (parent.isDirectModified(myPath) || this.isNew) {
|
|
203
178
|
return;
|
|
204
179
|
}
|
|
205
|
-
|
|
206
|
-
this.$__parent.markModified(pathToMark, this);
|
|
180
|
+
this.$__parent.markModified(fullPath, this);
|
|
207
181
|
};
|
|
208
182
|
|
|
209
183
|
/*!
|
|
@@ -229,7 +203,7 @@ Subdocument.prototype.isModified = function(paths, options, modifiedPaths) {
|
|
|
229
203
|
/**
|
|
230
204
|
* Marks a path as valid, removing existing validation errors.
|
|
231
205
|
*
|
|
232
|
-
* @param {
|
|
206
|
+
* @param {string} path the field to mark as valid
|
|
233
207
|
* @api private
|
|
234
208
|
* @method $markValid
|
|
235
209
|
* @memberOf Subdocument
|
|
@@ -286,7 +260,7 @@ Subdocument.prototype.ownerDocument = function() {
|
|
|
286
260
|
return this.$__.ownerDocument;
|
|
287
261
|
}
|
|
288
262
|
|
|
289
|
-
let parent = this;
|
|
263
|
+
let parent = this;
|
|
290
264
|
const paths = [];
|
|
291
265
|
const seenDocs = new Set([parent]);
|
|
292
266
|
|
|
@@ -318,7 +292,7 @@ Subdocument.prototype.ownerDocument = function() {
|
|
|
318
292
|
*/
|
|
319
293
|
|
|
320
294
|
Subdocument.prototype.$__fullPathWithIndexes = function() {
|
|
321
|
-
let parent = this;
|
|
295
|
+
let parent = this;
|
|
322
296
|
const paths = [];
|
|
323
297
|
const seenDocs = new Set([parent]);
|
|
324
298
|
|
|
@@ -371,22 +345,6 @@ Subdocument.prototype.$__setParent = function $__setParent(parent) {
|
|
|
371
345
|
this.$__parent = parent;
|
|
372
346
|
};
|
|
373
347
|
|
|
374
|
-
/**
|
|
375
|
-
* no-op for hooks
|
|
376
|
-
* @param {Function} cb
|
|
377
|
-
* @method $__deleteOne
|
|
378
|
-
* @memberOf Subdocument
|
|
379
|
-
* @instance
|
|
380
|
-
* @api private
|
|
381
|
-
*/
|
|
382
|
-
|
|
383
|
-
Subdocument.prototype.$__deleteOne = function(cb) {
|
|
384
|
-
if (cb == null) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
return cb(null, this);
|
|
388
|
-
};
|
|
389
|
-
|
|
390
348
|
/**
|
|
391
349
|
* ignore
|
|
392
350
|
* @method $__removeFromParent
|
|
@@ -402,27 +360,20 @@ Subdocument.prototype.$__removeFromParent = function() {
|
|
|
402
360
|
/**
|
|
403
361
|
* Null-out this subdoc
|
|
404
362
|
*
|
|
405
|
-
* @param {
|
|
406
|
-
* @param {Function} [callback] optional callback for compatibility with Document.prototype.remove
|
|
363
|
+
* @param {object} [options]
|
|
407
364
|
*/
|
|
408
365
|
|
|
409
|
-
Subdocument.prototype.deleteOne = function(options
|
|
410
|
-
if (typeof options === 'function') {
|
|
411
|
-
callback = options;
|
|
412
|
-
options = null;
|
|
413
|
-
}
|
|
366
|
+
Subdocument.prototype.deleteOne = function deleteOne(options) {
|
|
414
367
|
registerRemoveListener(this);
|
|
415
368
|
|
|
416
369
|
// If removing entire doc, no need to remove subdoc
|
|
417
|
-
if (!options
|
|
370
|
+
if (!options?.noop) {
|
|
418
371
|
this.$__removeFromParent();
|
|
419
372
|
|
|
420
373
|
const owner = this.ownerDocument();
|
|
421
374
|
owner.$__.removedSubdocs = owner.$__.removedSubdocs || [];
|
|
422
375
|
owner.$__.removedSubdocs.push(this);
|
|
423
376
|
}
|
|
424
|
-
|
|
425
|
-
return this.$__deleteOne(callback);
|
|
426
377
|
};
|
|
427
378
|
|
|
428
379
|
/*!
|
|
@@ -460,7 +411,7 @@ Subdocument.prototype.$toObject = function $toObject(options, json) {
|
|
|
460
411
|
|
|
461
412
|
// If `$toObject()` was called recursively, respect the minimize option, including schematype level minimize.
|
|
462
413
|
// If minimize is set, then we can minimize out the whole object.
|
|
463
|
-
if (
|
|
414
|
+
if (utils.hasOwnKeys(ret) === false && options?._calledWithOptions != null) {
|
|
464
415
|
const minimize = options._calledWithOptions?.minimize ?? this?.$__schemaTypeOptions?.minimize ?? options.minimize;
|
|
465
416
|
if (minimize && !this.constructor.$__required) {
|
|
466
417
|
return undefined;
|