@depup/mongodb 7.1.0-depup.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/LICENSE.md +201 -0
- package/README.md +33 -0
- package/etc/prepare.js +12 -0
- package/lib/admin.js +136 -0
- package/lib/admin.js.map +1 -0
- package/lib/bson.js +85 -0
- package/lib/bson.js.map +1 -0
- package/lib/bulk/common.js +835 -0
- package/lib/bulk/common.js.map +1 -0
- package/lib/bulk/ordered.js +67 -0
- package/lib/bulk/ordered.js.map +1 -0
- package/lib/bulk/unordered.js +92 -0
- package/lib/bulk/unordered.js.map +1 -0
- package/lib/change_stream.js +513 -0
- package/lib/change_stream.js.map +1 -0
- package/lib/client-side-encryption/auto_encrypter.js +272 -0
- package/lib/client-side-encryption/auto_encrypter.js.map +1 -0
- package/lib/client-side-encryption/client_encryption.js +609 -0
- package/lib/client-side-encryption/client_encryption.js.map +1 -0
- package/lib/client-side-encryption/errors.js +138 -0
- package/lib/client-side-encryption/errors.js.map +1 -0
- package/lib/client-side-encryption/mongocryptd_manager.js +85 -0
- package/lib/client-side-encryption/mongocryptd_manager.js.map +1 -0
- package/lib/client-side-encryption/providers/aws.js +23 -0
- package/lib/client-side-encryption/providers/aws.js.map +1 -0
- package/lib/client-side-encryption/providers/azure.js +132 -0
- package/lib/client-side-encryption/providers/azure.js.map +1 -0
- package/lib/client-side-encryption/providers/gcp.js +16 -0
- package/lib/client-side-encryption/providers/gcp.js.map +1 -0
- package/lib/client-side-encryption/providers/index.js +43 -0
- package/lib/client-side-encryption/providers/index.js.map +1 -0
- package/lib/client-side-encryption/state_machine.js +427 -0
- package/lib/client-side-encryption/state_machine.js.map +1 -0
- package/lib/cmap/auth/auth_provider.js +51 -0
- package/lib/cmap/auth/auth_provider.js.map +1 -0
- package/lib/cmap/auth/aws4.js +161 -0
- package/lib/cmap/auth/aws4.js.map +1 -0
- package/lib/cmap/auth/aws_temporary_credentials.js +103 -0
- package/lib/cmap/auth/aws_temporary_credentials.js.map +1 -0
- package/lib/cmap/auth/gssapi.js +155 -0
- package/lib/cmap/auth/gssapi.js.map +1 -0
- package/lib/cmap/auth/mongo_credentials.js +169 -0
- package/lib/cmap/auth/mongo_credentials.js.map +1 -0
- package/lib/cmap/auth/mongodb_aws.js +128 -0
- package/lib/cmap/auth/mongodb_aws.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js +84 -0
- package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +62 -0
- package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/callback_workflow.js +141 -0
- package/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/command_builders.js +44 -0
- package/lib/cmap/auth/mongodb_oidc/command_builders.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +39 -0
- package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js +122 -0
- package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +32 -0
- package/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/token_cache.js +52 -0
- package/lib/cmap/auth/mongodb_oidc/token_cache.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +23 -0
- package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc.js +73 -0
- package/lib/cmap/auth/mongodb_oidc.js.map +1 -0
- package/lib/cmap/auth/plain.js +26 -0
- package/lib/cmap/auth/plain.js.map +1 -0
- package/lib/cmap/auth/providers.js +22 -0
- package/lib/cmap/auth/providers.js.map +1 -0
- package/lib/cmap/auth/scram.js +254 -0
- package/lib/cmap/auth/scram.js.map +1 -0
- package/lib/cmap/auth/x509.js +36 -0
- package/lib/cmap/auth/x509.js.map +1 -0
- package/lib/cmap/command_monitoring_events.js +223 -0
- package/lib/cmap/command_monitoring_events.js.map +1 -0
- package/lib/cmap/commands.js +535 -0
- package/lib/cmap/commands.js.map +1 -0
- package/lib/cmap/connect.js +381 -0
- package/lib/cmap/connect.js.map +1 -0
- package/lib/cmap/connection.js +571 -0
- package/lib/cmap/connection.js.map +1 -0
- package/lib/cmap/connection_pool.js +558 -0
- package/lib/cmap/connection_pool.js.map +1 -0
- package/lib/cmap/connection_pool_events.js +190 -0
- package/lib/cmap/connection_pool_events.js.map +1 -0
- package/lib/cmap/errors.js +108 -0
- package/lib/cmap/errors.js.map +1 -0
- package/lib/cmap/handshake/client_metadata.js +242 -0
- package/lib/cmap/handshake/client_metadata.js.map +1 -0
- package/lib/cmap/metrics.js +62 -0
- package/lib/cmap/metrics.js.map +1 -0
- package/lib/cmap/stream_description.js +70 -0
- package/lib/cmap/stream_description.js.map +1 -0
- package/lib/cmap/wire_protocol/compression.js +178 -0
- package/lib/cmap/wire_protocol/compression.js.map +1 -0
- package/lib/cmap/wire_protocol/constants.js +21 -0
- package/lib/cmap/wire_protocol/constants.js.map +1 -0
- package/lib/cmap/wire_protocol/on_data.js +111 -0
- package/lib/cmap/wire_protocol/on_data.js.map +1 -0
- package/lib/cmap/wire_protocol/on_demand/document.js +222 -0
- package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -0
- package/lib/cmap/wire_protocol/responses.js +315 -0
- package/lib/cmap/wire_protocol/responses.js.map +1 -0
- package/lib/cmap/wire_protocol/shared.js +35 -0
- package/lib/cmap/wire_protocol/shared.js.map +1 -0
- package/lib/collection.js +751 -0
- package/lib/collection.js.map +1 -0
- package/lib/connection_string.js +1090 -0
- package/lib/connection_string.js.map +1 -0
- package/lib/constants.js +170 -0
- package/lib/constants.js.map +1 -0
- package/lib/cursor/abstract_cursor.js +924 -0
- package/lib/cursor/abstract_cursor.js.map +1 -0
- package/lib/cursor/aggregation_cursor.js +164 -0
- package/lib/cursor/aggregation_cursor.js.map +1 -0
- package/lib/cursor/change_stream_cursor.js +104 -0
- package/lib/cursor/change_stream_cursor.js.map +1 -0
- package/lib/cursor/client_bulk_write_cursor.js +52 -0
- package/lib/cursor/client_bulk_write_cursor.js.map +1 -0
- package/lib/cursor/explainable_cursor.js +36 -0
- package/lib/cursor/explainable_cursor.js.map +1 -0
- package/lib/cursor/find_cursor.js +399 -0
- package/lib/cursor/find_cursor.js.map +1 -0
- package/lib/cursor/list_collections_cursor.js +34 -0
- package/lib/cursor/list_collections_cursor.js.map +1 -0
- package/lib/cursor/list_indexes_cursor.js +32 -0
- package/lib/cursor/list_indexes_cursor.js.map +1 -0
- package/lib/cursor/list_search_indexes_cursor.js +14 -0
- package/lib/cursor/list_search_indexes_cursor.js.map +1 -0
- package/lib/cursor/run_command_cursor.js +94 -0
- package/lib/cursor/run_command_cursor.js.map +1 -0
- package/lib/db.js +419 -0
- package/lib/db.js.map +1 -0
- package/lib/deps.js +112 -0
- package/lib/deps.js.map +1 -0
- package/lib/encrypter.js +106 -0
- package/lib/encrypter.js.map +1 -0
- package/lib/error.js +1380 -0
- package/lib/error.js.map +1 -0
- package/lib/explain.js +59 -0
- package/lib/explain.js.map +1 -0
- package/lib/gridfs/download.js +305 -0
- package/lib/gridfs/download.js.map +1 -0
- package/lib/gridfs/index.js +164 -0
- package/lib/gridfs/index.js.map +1 -0
- package/lib/gridfs/upload.js +358 -0
- package/lib/gridfs/upload.js.map +1 -0
- package/lib/index.js +193 -0
- package/lib/index.js.map +1 -0
- package/lib/mongo_client.js +557 -0
- package/lib/mongo_client.js.map +1 -0
- package/lib/mongo_client_auth_providers.js +80 -0
- package/lib/mongo_client_auth_providers.js.map +1 -0
- package/lib/mongo_logger.js +655 -0
- package/lib/mongo_logger.js.map +1 -0
- package/lib/mongo_types.js +56 -0
- package/lib/mongo_types.js.map +1 -0
- package/lib/operations/aggregate.js +90 -0
- package/lib/operations/aggregate.js.map +1 -0
- package/lib/operations/client_bulk_write/client_bulk_write.js +51 -0
- package/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -0
- package/lib/operations/client_bulk_write/command_builder.js +340 -0
- package/lib/operations/client_bulk_write/command_builder.js.map +1 -0
- package/lib/operations/client_bulk_write/common.js +3 -0
- package/lib/operations/client_bulk_write/common.js.map +1 -0
- package/lib/operations/client_bulk_write/executor.js +120 -0
- package/lib/operations/client_bulk_write/executor.js.map +1 -0
- package/lib/operations/client_bulk_write/results_merger.js +204 -0
- package/lib/operations/client_bulk_write/results_merger.js.map +1 -0
- package/lib/operations/command.js +83 -0
- package/lib/operations/command.js.map +1 -0
- package/lib/operations/count.js +45 -0
- package/lib/operations/count.js.map +1 -0
- package/lib/operations/create_collection.js +109 -0
- package/lib/operations/create_collection.js.map +1 -0
- package/lib/operations/delete.js +125 -0
- package/lib/operations/delete.js.map +1 -0
- package/lib/operations/distinct.js +61 -0
- package/lib/operations/distinct.js.map +1 -0
- package/lib/operations/drop.js +93 -0
- package/lib/operations/drop.js.map +1 -0
- package/lib/operations/end_sessions.js +34 -0
- package/lib/operations/end_sessions.js.map +1 -0
- package/lib/operations/estimated_document_count.js +41 -0
- package/lib/operations/estimated_document_count.js.map +1 -0
- package/lib/operations/execute_operation.js +239 -0
- package/lib/operations/execute_operation.js.map +1 -0
- package/lib/operations/find.js +148 -0
- package/lib/operations/find.js.map +1 -0
- package/lib/operations/find_and_modify.js +158 -0
- package/lib/operations/find_and_modify.js.map +1 -0
- package/lib/operations/get_more.js +62 -0
- package/lib/operations/get_more.js.map +1 -0
- package/lib/operations/indexes.js +186 -0
- package/lib/operations/indexes.js.map +1 -0
- package/lib/operations/insert.js +70 -0
- package/lib/operations/insert.js.map +1 -0
- package/lib/operations/kill_cursors.js +43 -0
- package/lib/operations/kill_cursors.js.map +1 -0
- package/lib/operations/list_collections.js +53 -0
- package/lib/operations/list_collections.js.map +1 -0
- package/lib/operations/list_databases.js +40 -0
- package/lib/operations/list_databases.js.map +1 -0
- package/lib/operations/operation.js +102 -0
- package/lib/operations/operation.js.map +1 -0
- package/lib/operations/profiling_level.js +43 -0
- package/lib/operations/profiling_level.js.map +1 -0
- package/lib/operations/remove_user.js +27 -0
- package/lib/operations/remove_user.js.map +1 -0
- package/lib/operations/rename.js +38 -0
- package/lib/operations/rename.js.map +1 -0
- package/lib/operations/run_command.js +47 -0
- package/lib/operations/run_command.js.map +1 -0
- package/lib/operations/search_indexes/create.js +33 -0
- package/lib/operations/search_indexes/create.js.map +1 -0
- package/lib/operations/search_indexes/drop.js +43 -0
- package/lib/operations/search_indexes/drop.js.map +1 -0
- package/lib/operations/search_indexes/update.js +35 -0
- package/lib/operations/search_indexes/update.js.map +1 -0
- package/lib/operations/set_profiling_level.js +53 -0
- package/lib/operations/set_profiling_level.js.map +1 -0
- package/lib/operations/stats.js +27 -0
- package/lib/operations/stats.js.map +1 -0
- package/lib/operations/update.js +188 -0
- package/lib/operations/update.js.map +1 -0
- package/lib/operations/validate_collection.js +37 -0
- package/lib/operations/validate_collection.js.map +1 -0
- package/lib/read_concern.js +73 -0
- package/lib/read_concern.js.map +1 -0
- package/lib/read_preference.js +191 -0
- package/lib/read_preference.js.map +1 -0
- package/lib/sdam/common.js +49 -0
- package/lib/sdam/common.js.map +1 -0
- package/lib/sdam/events.js +146 -0
- package/lib/sdam/events.js.map +1 -0
- package/lib/sdam/monitor.js +544 -0
- package/lib/sdam/monitor.js.map +1 -0
- package/lib/sdam/server.js +404 -0
- package/lib/sdam/server.js.map +1 -0
- package/lib/sdam/server_description.js +204 -0
- package/lib/sdam/server_description.js.map +1 -0
- package/lib/sdam/server_selection.js +294 -0
- package/lib/sdam/server_selection.js.map +1 -0
- package/lib/sdam/server_selection_events.js +85 -0
- package/lib/sdam/server_selection_events.js.map +1 -0
- package/lib/sdam/srv_polling.js +108 -0
- package/lib/sdam/srv_polling.js.map +1 -0
- package/lib/sdam/topology.js +652 -0
- package/lib/sdam/topology.js.map +1 -0
- package/lib/sdam/topology_description.js +383 -0
- package/lib/sdam/topology_description.js.map +1 -0
- package/lib/sessions.js +892 -0
- package/lib/sessions.js.map +1 -0
- package/lib/sort.js +103 -0
- package/lib/sort.js.map +1 -0
- package/lib/timeout.js +296 -0
- package/lib/timeout.js.map +1 -0
- package/lib/transactions.js +135 -0
- package/lib/transactions.js.map +1 -0
- package/lib/utils.js +1163 -0
- package/lib/utils.js.map +1 -0
- package/lib/write_concern.js +100 -0
- package/lib/write_concern.js.map +1 -0
- package/mongodb.d.ts +9018 -0
- package/package.json +197 -0
- package/src/admin.ts +173 -0
- package/src/bson.ts +149 -0
- package/src/bulk/common.ts +1251 -0
- package/src/bulk/ordered.ts +83 -0
- package/src/bulk/unordered.ts +115 -0
- package/src/change_stream.ts +1160 -0
- package/src/client-side-encryption/auto_encrypter.ts +469 -0
- package/src/client-side-encryption/client_encryption.ts +1150 -0
- package/src/client-side-encryption/errors.ts +144 -0
- package/src/client-side-encryption/mongocryptd_manager.ts +100 -0
- package/src/client-side-encryption/providers/aws.ts +33 -0
- package/src/client-side-encryption/providers/azure.ts +181 -0
- package/src/client-side-encryption/providers/gcp.ts +16 -0
- package/src/client-side-encryption/providers/index.ts +207 -0
- package/src/client-side-encryption/state_machine.ts +651 -0
- package/src/cmap/auth/auth_provider.ts +77 -0
- package/src/cmap/auth/aws4.ts +207 -0
- package/src/cmap/auth/aws_temporary_credentials.ts +129 -0
- package/src/cmap/auth/gssapi.ts +203 -0
- package/src/cmap/auth/mongo_credentials.ts +292 -0
- package/src/cmap/auth/mongodb_aws.ts +179 -0
- package/src/cmap/auth/mongodb_oidc/automated_callback_workflow.ts +88 -0
- package/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts +73 -0
- package/src/cmap/auth/mongodb_oidc/callback_workflow.ts +188 -0
- package/src/cmap/auth/mongodb_oidc/command_builders.ts +53 -0
- package/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts +46 -0
- package/src/cmap/auth/mongodb_oidc/human_callback_workflow.ts +141 -0
- package/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts +31 -0
- package/src/cmap/auth/mongodb_oidc/token_cache.ts +62 -0
- package/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts +22 -0
- package/src/cmap/auth/mongodb_oidc.ts +185 -0
- package/src/cmap/auth/plain.ts +25 -0
- package/src/cmap/auth/providers.ts +22 -0
- package/src/cmap/auth/scram.ts +344 -0
- package/src/cmap/auth/x509.ts +43 -0
- package/src/cmap/command_monitoring_events.ts +316 -0
- package/src/cmap/commands.ts +788 -0
- package/src/cmap/connect.ts +518 -0
- package/src/cmap/connection.ts +931 -0
- package/src/cmap/connection_pool.ts +831 -0
- package/src/cmap/connection_pool_events.ts +300 -0
- package/src/cmap/errors.ts +119 -0
- package/src/cmap/handshake/client_metadata.ts +353 -0
- package/src/cmap/metrics.ts +58 -0
- package/src/cmap/stream_description.ts +96 -0
- package/src/cmap/wire_protocol/compression.ts +211 -0
- package/src/cmap/wire_protocol/constants.ts +17 -0
- package/src/cmap/wire_protocol/on_data.ts +139 -0
- package/src/cmap/wire_protocol/on_demand/document.ts +358 -0
- package/src/cmap/wire_protocol/responses.ts +393 -0
- package/src/cmap/wire_protocol/shared.ts +48 -0
- package/src/collection.ts +1314 -0
- package/src/connection_string.ts +1297 -0
- package/src/constants.ts +176 -0
- package/src/cursor/abstract_cursor.ts +1247 -0
- package/src/cursor/aggregation_cursor.ts +245 -0
- package/src/cursor/change_stream_cursor.ts +171 -0
- package/src/cursor/client_bulk_write_cursor.ts +83 -0
- package/src/cursor/explainable_cursor.ts +51 -0
- package/src/cursor/find_cursor.ts +497 -0
- package/src/cursor/list_collections_cursor.ts +50 -0
- package/src/cursor/list_indexes_cursor.ts +37 -0
- package/src/cursor/list_search_indexes_cursor.ts +20 -0
- package/src/cursor/run_command_cursor.ts +178 -0
- package/src/db.ts +621 -0
- package/src/deps.ts +227 -0
- package/src/encrypter.ts +127 -0
- package/src/error.ts +1567 -0
- package/src/explain.ts +124 -0
- package/src/gridfs/download.ts +483 -0
- package/src/gridfs/index.ts +264 -0
- package/src/gridfs/upload.ts +537 -0
- package/src/index.ts +633 -0
- package/src/mongo_client.ts +1155 -0
- package/src/mongo_client_auth_providers.ts +87 -0
- package/src/mongo_logger.ts +1081 -0
- package/src/mongo_types.ts +678 -0
- package/src/operations/aggregate.ts +153 -0
- package/src/operations/client_bulk_write/client_bulk_write.ts +72 -0
- package/src/operations/client_bulk_write/command_builder.ts +487 -0
- package/src/operations/client_bulk_write/common.ts +276 -0
- package/src/operations/client_bulk_write/executor.ts +149 -0
- package/src/operations/client_bulk_write/results_merger.ts +260 -0
- package/src/operations/command.ts +171 -0
- package/src/operations/count.ts +74 -0
- package/src/operations/create_collection.ts +218 -0
- package/src/operations/delete.ts +183 -0
- package/src/operations/distinct.ts +92 -0
- package/src/operations/drop.ts +130 -0
- package/src/operations/end_sessions.ts +44 -0
- package/src/operations/estimated_document_count.ts +61 -0
- package/src/operations/execute_operation.ts +319 -0
- package/src/operations/find.ts +254 -0
- package/src/operations/find_and_modify.ts +319 -0
- package/src/operations/get_more.ts +108 -0
- package/src/operations/indexes.ts +418 -0
- package/src/operations/insert.ts +108 -0
- package/src/operations/kill_cursors.ts +64 -0
- package/src/operations/list_collections.ts +108 -0
- package/src/operations/list_databases.ts +68 -0
- package/src/operations/operation.ts +181 -0
- package/src/operations/profiling_level.ts +46 -0
- package/src/operations/remove_user.ts +36 -0
- package/src/operations/rename.ts +60 -0
- package/src/operations/run_command.ts +79 -0
- package/src/operations/search_indexes/create.ts +56 -0
- package/src/operations/search_indexes/drop.ts +58 -0
- package/src/operations/search_indexes/update.ts +45 -0
- package/src/operations/set_profiling_level.ts +74 -0
- package/src/operations/stats.ts +37 -0
- package/src/operations/update.ts +318 -0
- package/src/operations/validate_collection.ts +50 -0
- package/src/read_concern.ts +88 -0
- package/src/read_preference.ts +256 -0
- package/src/sdam/common.ts +74 -0
- package/src/sdam/events.ts +219 -0
- package/src/sdam/monitor.ts +771 -0
- package/src/sdam/server.ts +595 -0
- package/src/sdam/server_description.ts +297 -0
- package/src/sdam/server_selection.ts +415 -0
- package/src/sdam/server_selection_events.ts +142 -0
- package/src/sdam/srv_polling.ts +146 -0
- package/src/sdam/topology.ts +1100 -0
- package/src/sdam/topology_description.ts +548 -0
- package/src/sessions.ts +1244 -0
- package/src/sort.ts +141 -0
- package/src/timeout.ts +405 -0
- package/src/transactions.ts +181 -0
- package/src/utils.ts +1434 -0
- package/src/write_concern.ts +183 -0
- package/tsconfig.json +46 -0
package/package.json
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@depup/mongodb",
|
|
3
|
+
"version": "7.1.0-depup.0",
|
|
4
|
+
"description": "[DepUp] The official MongoDB driver for Node.js",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib",
|
|
8
|
+
"src",
|
|
9
|
+
"etc/prepare.js",
|
|
10
|
+
"mongodb.d.ts",
|
|
11
|
+
"tsconfig.json"
|
|
12
|
+
],
|
|
13
|
+
"types": "mongodb.d.ts",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git@github.com:mongodb/node-mongodb-native.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"depup",
|
|
20
|
+
"dependency-bumped",
|
|
21
|
+
"updated-deps",
|
|
22
|
+
"mongodb",
|
|
23
|
+
"driver",
|
|
24
|
+
"official"
|
|
25
|
+
],
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "The MongoDB NodeJS Team",
|
|
28
|
+
"email": "dbx-node@mongodb.com"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@mongodb-js/saslprep": "^1.4.6",
|
|
32
|
+
"bson": "^7.2.0",
|
|
33
|
+
"mongodb-connection-string-url": "^7.0.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@aws-sdk/credential-providers": "^3.806.0",
|
|
37
|
+
"@mongodb-js/zstd": "^7.0.0",
|
|
38
|
+
"gcp-metadata": "^7.0.1",
|
|
39
|
+
"kerberos": "^7.0.0",
|
|
40
|
+
"mongodb-client-encryption": ">=7.0.0 <7.1.0",
|
|
41
|
+
"snappy": "^7.3.2",
|
|
42
|
+
"socks": "^2.8.6"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"@aws-sdk/credential-providers": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"@mongodb-js/zstd": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"kerberos": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"snappy": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"mongodb-client-encryption": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"gcp-metadata": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"socks": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@aws-sdk/credential-providers": "^3.876.0",
|
|
69
|
+
"@iarna/toml": "^2.2.5",
|
|
70
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
71
|
+
"@microsoft/api-extractor": "^7.54.0",
|
|
72
|
+
"@microsoft/tsdoc-config": "^0.17.1",
|
|
73
|
+
"@mongodb-js/zstd": "^7.0.0",
|
|
74
|
+
"@types/chai": "^4.3.17",
|
|
75
|
+
"@types/chai-subset": "^1.3.5",
|
|
76
|
+
"@types/express": "^5.0.5",
|
|
77
|
+
"@types/kerberos": "^1.1.5",
|
|
78
|
+
"@types/mocha": "^10.0.9",
|
|
79
|
+
"@types/node": "^22.15.3",
|
|
80
|
+
"@types/saslprep": "^1.0.3",
|
|
81
|
+
"@types/semver": "^7.7.0",
|
|
82
|
+
"@types/sinon": "^17.0.4",
|
|
83
|
+
"@types/sinon-chai": "^4.0.0",
|
|
84
|
+
"@types/whatwg-url": "^13.0.0",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
86
|
+
"@typescript-eslint/parser": "^8.31.1",
|
|
87
|
+
"aws4": "^1.13.2",
|
|
88
|
+
"chai": "^4.4.1",
|
|
89
|
+
"chai-subset": "^1.6.0",
|
|
90
|
+
"chalk": "^4.1.2",
|
|
91
|
+
"eslint": "^9.39.1",
|
|
92
|
+
"eslint-config-prettier": "^10.1.8",
|
|
93
|
+
"eslint-plugin-mocha": "^10.4.1",
|
|
94
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
95
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
96
|
+
"eslint-plugin-tsdoc": "^0.4.0",
|
|
97
|
+
"eslint-plugin-unused-imports": "^4.2.0",
|
|
98
|
+
"express": "^5.1.0",
|
|
99
|
+
"gcp-metadata": "^7.0.1",
|
|
100
|
+
"js-yaml": "^4.1.0",
|
|
101
|
+
"mocha": "^11.7.5",
|
|
102
|
+
"mocha-sinon": "^2.1.2",
|
|
103
|
+
"mongodb-client-encryption": "^7.0.0",
|
|
104
|
+
"nyc": "^17.1.0",
|
|
105
|
+
"prettier": "^3.6.2",
|
|
106
|
+
"semver": "^7.7.2",
|
|
107
|
+
"sinon": "^18.0.1",
|
|
108
|
+
"sinon-chai": "^3.7.0",
|
|
109
|
+
"snappy": "^7.3.2",
|
|
110
|
+
"socks": "^2.8.7",
|
|
111
|
+
"source-map-support": "^0.5.21",
|
|
112
|
+
"ts-node": "^10.9.2",
|
|
113
|
+
"tsd": "^0.33.0",
|
|
114
|
+
"typescript": "5.8.3",
|
|
115
|
+
"typescript-cached-transpile": "^0.0.6",
|
|
116
|
+
"v8-heapsnapshot": "^1.3.1",
|
|
117
|
+
"yargs": "^18.0.0"
|
|
118
|
+
},
|
|
119
|
+
"license": "Apache-2.0",
|
|
120
|
+
"engines": {
|
|
121
|
+
"node": ">=20.19.0"
|
|
122
|
+
},
|
|
123
|
+
"bugs": {
|
|
124
|
+
"url": "https://jira.mongodb.org/projects/NODE/issues/"
|
|
125
|
+
},
|
|
126
|
+
"homepage": "https://github.com/mongodb/node-mongodb-native",
|
|
127
|
+
"scripts": {
|
|
128
|
+
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
|
|
129
|
+
"build:ts": "node ./node_modules/typescript/bin/tsc",
|
|
130
|
+
"build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts",
|
|
131
|
+
"build:docs": "./etc/docs/build.ts",
|
|
132
|
+
"build:typedoc": "typedoc",
|
|
133
|
+
"build:nightly": "node ./.github/scripts/nightly.mjs",
|
|
134
|
+
"check:bench": "npm --prefix test/benchmarks/driver_bench start",
|
|
135
|
+
"check:coverage": "nyc npm run test:all",
|
|
136
|
+
"check:integration-coverage": "nyc npm run check:test",
|
|
137
|
+
"check:lambda": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js",
|
|
138
|
+
"check:lambda:aws": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js",
|
|
139
|
+
"check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd",
|
|
140
|
+
"check:eslint": "npm run build:dts && ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ext '.js,.ts' src test",
|
|
141
|
+
"check:tsd": "tsd --version && tsd",
|
|
142
|
+
"check:dependencies": "mocha test/action/dependency.test.ts",
|
|
143
|
+
"check:dts": "node ./node_modules/typescript/bin/tsc --target es2023 --module commonjs --noEmit mongodb.d.ts && tsd",
|
|
144
|
+
"check:search-indexes": "nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts",
|
|
145
|
+
"check:test": "mocha --config test/mocha_mongodb.js test/integration",
|
|
146
|
+
"check:unit": "nyc mocha test/unit",
|
|
147
|
+
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
|
|
148
|
+
"check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
|
|
149
|
+
"check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
|
|
150
|
+
"check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts test/integration/auth/mongodb_aws.prose.test.ts",
|
|
151
|
+
"check:oidc-auth": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",
|
|
152
|
+
"check:oidc-test": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts",
|
|
153
|
+
"check:kerberos": "nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts",
|
|
154
|
+
"check:tls": "nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts",
|
|
155
|
+
"check:ldap": "nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts",
|
|
156
|
+
"check:socks5": "nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts",
|
|
157
|
+
"check:csfle": "nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption",
|
|
158
|
+
"check:snappy": "nyc mocha test/unit/assorted/snappy.test.js",
|
|
159
|
+
"check:x509": "nyc mocha test/manual/x509_auth.test.ts",
|
|
160
|
+
"fix:eslint": "npm run check:eslint -- --fix",
|
|
161
|
+
"prepare": "node etc/prepare.js",
|
|
162
|
+
"preview:docs": "ts-node etc/docs/preview.ts",
|
|
163
|
+
"test": "npm run check:lint && npm run test:all",
|
|
164
|
+
"test:all": "npm run check:unit && npm run check:test",
|
|
165
|
+
"update:docs": "npm run build:docs -- --yes"
|
|
166
|
+
},
|
|
167
|
+
"tsd": {
|
|
168
|
+
"directory": "test/types",
|
|
169
|
+
"compilerOptions": {
|
|
170
|
+
"strict": true,
|
|
171
|
+
"target": "esnext",
|
|
172
|
+
"module": "commonjs",
|
|
173
|
+
"moduleResolution": "node"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"depup": {
|
|
177
|
+
"changes": {
|
|
178
|
+
"@mongodb-js/saslprep": {
|
|
179
|
+
"from": "^1.3.0",
|
|
180
|
+
"to": "^1.4.6"
|
|
181
|
+
},
|
|
182
|
+
"bson": {
|
|
183
|
+
"from": "^7.1.1",
|
|
184
|
+
"to": "^7.2.0"
|
|
185
|
+
},
|
|
186
|
+
"mongodb-connection-string-url": {
|
|
187
|
+
"from": "^7.0.0",
|
|
188
|
+
"to": "^7.0.1"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"depsUpdated": 3,
|
|
192
|
+
"originalPackage": "mongodb",
|
|
193
|
+
"originalVersion": "7.1.0",
|
|
194
|
+
"processedAt": "2026-03-09T04:58:47.350Z",
|
|
195
|
+
"smokeTest": "passed"
|
|
196
|
+
}
|
|
197
|
+
}
|
package/src/admin.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { type Document, resolveBSONOptions } from './bson';
|
|
2
|
+
import type { Db } from './db';
|
|
3
|
+
import type { CommandOperationOptions } from './operations/command';
|
|
4
|
+
import { executeOperation } from './operations/execute_operation';
|
|
5
|
+
import {
|
|
6
|
+
ListDatabasesOperation,
|
|
7
|
+
type ListDatabasesOptions,
|
|
8
|
+
type ListDatabasesResult
|
|
9
|
+
} from './operations/list_databases';
|
|
10
|
+
import { RemoveUserOperation, type RemoveUserOptions } from './operations/remove_user';
|
|
11
|
+
import { RunCommandOperation, type RunCommandOptions } from './operations/run_command';
|
|
12
|
+
import {
|
|
13
|
+
ValidateCollectionOperation,
|
|
14
|
+
type ValidateCollectionOptions
|
|
15
|
+
} from './operations/validate_collection';
|
|
16
|
+
import { MongoDBNamespace } from './utils';
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export interface AdminPrivate {
|
|
20
|
+
db: Db;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The **Admin** class is an internal class that allows convenient access to
|
|
25
|
+
* the admin functionality and commands for MongoDB.
|
|
26
|
+
*
|
|
27
|
+
* **ADMIN Cannot directly be instantiated**
|
|
28
|
+
* @public
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { MongoClient } from 'mongodb';
|
|
33
|
+
*
|
|
34
|
+
* const client = new MongoClient('mongodb://localhost:27017');
|
|
35
|
+
* const admin = client.db().admin();
|
|
36
|
+
* const dbInfo = await admin.listDatabases();
|
|
37
|
+
* for (const db of dbInfo.databases) {
|
|
38
|
+
* console.log(db.name);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export class Admin {
|
|
43
|
+
/** @internal */
|
|
44
|
+
s: AdminPrivate;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Create a new Admin instance
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
constructor(db: Db) {
|
|
51
|
+
this.s = { db };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Execute a command
|
|
56
|
+
*
|
|
57
|
+
* The driver will ensure the following fields are attached to the command sent to the server:
|
|
58
|
+
* - `lsid` - sourced from an implicit session or options.session
|
|
59
|
+
* - `$readPreference` - defaults to primary or can be configured by options.readPreference
|
|
60
|
+
* - `$db` - sourced from the name of this database
|
|
61
|
+
*
|
|
62
|
+
* If the client has a serverApi setting:
|
|
63
|
+
* - `apiVersion`
|
|
64
|
+
* - `apiStrict`
|
|
65
|
+
* - `apiDeprecationErrors`
|
|
66
|
+
*
|
|
67
|
+
* When in a transaction:
|
|
68
|
+
* - `readConcern` - sourced from readConcern set on the TransactionOptions
|
|
69
|
+
* - `writeConcern` - sourced from writeConcern set on the TransactionOptions
|
|
70
|
+
*
|
|
71
|
+
* Attaching any of the above fields to the command will have no effect as the driver will overwrite the value.
|
|
72
|
+
*
|
|
73
|
+
* @param command - The command to execute
|
|
74
|
+
* @param options - Optional settings for the command
|
|
75
|
+
*/
|
|
76
|
+
async command(command: Document, options?: RunCommandOptions): Promise<Document> {
|
|
77
|
+
return await executeOperation(
|
|
78
|
+
this.s.db.client,
|
|
79
|
+
new RunCommandOperation(new MongoDBNamespace('admin'), command, {
|
|
80
|
+
...resolveBSONOptions(options),
|
|
81
|
+
session: options?.session,
|
|
82
|
+
readPreference: options?.readPreference,
|
|
83
|
+
timeoutMS: options?.timeoutMS ?? this.s.db.timeoutMS
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Retrieve the server build information
|
|
90
|
+
*
|
|
91
|
+
* @param options - Optional settings for the command
|
|
92
|
+
*/
|
|
93
|
+
async buildInfo(options?: CommandOperationOptions): Promise<Document> {
|
|
94
|
+
return await this.command({ buildinfo: 1 }, options);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Retrieve the server build information
|
|
99
|
+
*
|
|
100
|
+
* @param options - Optional settings for the command
|
|
101
|
+
*/
|
|
102
|
+
async serverInfo(options?: CommandOperationOptions): Promise<Document> {
|
|
103
|
+
return await this.command({ buildinfo: 1 }, options);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Retrieve this db's server status.
|
|
108
|
+
*
|
|
109
|
+
* @param options - Optional settings for the command
|
|
110
|
+
*/
|
|
111
|
+
async serverStatus(options?: CommandOperationOptions): Promise<Document> {
|
|
112
|
+
return await this.command({ serverStatus: 1 }, options);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Ping the MongoDB server and retrieve results
|
|
117
|
+
*
|
|
118
|
+
* @param options - Optional settings for the command
|
|
119
|
+
*/
|
|
120
|
+
async ping(options?: CommandOperationOptions): Promise<Document> {
|
|
121
|
+
return await this.command({ ping: 1 }, options);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Remove a user from a database
|
|
126
|
+
*
|
|
127
|
+
* @param username - The username to remove
|
|
128
|
+
* @param options - Optional settings for the command
|
|
129
|
+
*/
|
|
130
|
+
async removeUser(username: string, options?: RemoveUserOptions): Promise<boolean> {
|
|
131
|
+
return await executeOperation(
|
|
132
|
+
this.s.db.client,
|
|
133
|
+
new RemoveUserOperation(this.s.db, username, { dbName: 'admin', ...options })
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Validate an existing collection
|
|
139
|
+
*
|
|
140
|
+
* @param collectionName - The name of the collection to validate.
|
|
141
|
+
* @param options - Optional settings for the command
|
|
142
|
+
*/
|
|
143
|
+
async validateCollection(
|
|
144
|
+
collectionName: string,
|
|
145
|
+
options: ValidateCollectionOptions = {}
|
|
146
|
+
): Promise<Document> {
|
|
147
|
+
return await executeOperation(
|
|
148
|
+
this.s.db.client,
|
|
149
|
+
new ValidateCollectionOperation(this, collectionName, options)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* List the available databases
|
|
155
|
+
*
|
|
156
|
+
* @param options - Optional settings for the command
|
|
157
|
+
*/
|
|
158
|
+
async listDatabases(options?: ListDatabasesOptions): Promise<ListDatabasesResult> {
|
|
159
|
+
return await executeOperation(
|
|
160
|
+
this.s.db.client,
|
|
161
|
+
new ListDatabasesOperation(this.s.db, { timeoutMS: this.s.db.timeoutMS, ...options })
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Get ReplicaSet status
|
|
167
|
+
*
|
|
168
|
+
* @param options - Optional settings for the command
|
|
169
|
+
*/
|
|
170
|
+
async replSetGetStatus(options?: CommandOperationOptions): Promise<Document> {
|
|
171
|
+
return await this.command({ replSetGetStatus: 1 }, options);
|
|
172
|
+
}
|
|
173
|
+
}
|
package/src/bson.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* eslint-disable no-restricted-imports */
|
|
2
|
+
import { BSON, type DeserializeOptions, type SerializeOptions } from 'bson';
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
Binary,
|
|
6
|
+
BSON,
|
|
7
|
+
BSONError,
|
|
8
|
+
BSONRegExp,
|
|
9
|
+
BSONSymbol,
|
|
10
|
+
BSONType,
|
|
11
|
+
calculateObjectSize,
|
|
12
|
+
Code,
|
|
13
|
+
DBRef,
|
|
14
|
+
Decimal128,
|
|
15
|
+
deserialize,
|
|
16
|
+
type DeserializeOptions,
|
|
17
|
+
Document,
|
|
18
|
+
Double,
|
|
19
|
+
EJSON,
|
|
20
|
+
EJSONOptions,
|
|
21
|
+
Int32,
|
|
22
|
+
Long,
|
|
23
|
+
MaxKey,
|
|
24
|
+
MinKey,
|
|
25
|
+
NumberUtils,
|
|
26
|
+
ObjectId,
|
|
27
|
+
type ObjectIdLike,
|
|
28
|
+
serialize,
|
|
29
|
+
Timestamp,
|
|
30
|
+
UUID
|
|
31
|
+
} from 'bson';
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export type BSONElement = BSON.OnDemand['BSONElement'];
|
|
35
|
+
|
|
36
|
+
export function parseToElementsToArray(bytes: Uint8Array, offset?: number): BSONElement[] {
|
|
37
|
+
const res = BSON.onDemand.parseToElements(bytes, offset);
|
|
38
|
+
return Array.isArray(res) ? res : [...res];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const getInt32LE = BSON.onDemand.NumberUtils.getInt32LE;
|
|
42
|
+
export const getFloat64LE = BSON.onDemand.NumberUtils.getFloat64LE;
|
|
43
|
+
export const getBigInt64LE = BSON.onDemand.NumberUtils.getBigInt64LE;
|
|
44
|
+
export const toUTF8 = BSON.onDemand.ByteUtils.toUTF8;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* BSON Serialization options.
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface BSONSerializeOptions
|
|
51
|
+
extends Omit<SerializeOptions, 'index'>,
|
|
52
|
+
Omit<
|
|
53
|
+
DeserializeOptions,
|
|
54
|
+
| 'evalFunctions'
|
|
55
|
+
| 'cacheFunctions'
|
|
56
|
+
| 'cacheFunctionsCrc32'
|
|
57
|
+
| 'allowObjectSmallerThanBufferSize'
|
|
58
|
+
| 'index'
|
|
59
|
+
| 'validation'
|
|
60
|
+
> {
|
|
61
|
+
/**
|
|
62
|
+
* Enabling the raw option will return a [Node.js Buffer](https://nodejs.org/api/buffer.html)
|
|
63
|
+
* which is allocated using [allocUnsafe API](https://nodejs.org/api/buffer.html#static-method-bufferallocunsafesize).
|
|
64
|
+
* See this section from the [Node.js Docs here](https://nodejs.org/api/buffer.html#what-makes-bufferallocunsafe-and-bufferallocunsafeslow-unsafe)
|
|
65
|
+
* for more detail about what "unsafe" refers to in this context.
|
|
66
|
+
* If you need to maintain your own editable clone of the bytes returned for an extended life time of the process, it is recommended you allocate
|
|
67
|
+
* your own buffer and clone the contents:
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const raw = await collection.findOne({}, { raw: true });
|
|
72
|
+
* const myBuffer = Buffer.alloc(raw.byteLength);
|
|
73
|
+
* myBuffer.set(raw, 0);
|
|
74
|
+
* // Only save and use `myBuffer` beyond this point
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Please note there is a known limitation where this option cannot be used at the MongoClient level (see [NODE-3946](https://jira.mongodb.org/browse/NODE-3946)).
|
|
79
|
+
* It does correctly work at `Db`, `Collection`, and per operation the same as other BSON options work.
|
|
80
|
+
*/
|
|
81
|
+
raw?: boolean;
|
|
82
|
+
|
|
83
|
+
/** Enable utf8 validation when deserializing BSON documents. Defaults to true. */
|
|
84
|
+
enableUtf8Validation?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function pluckBSONSerializeOptions(options: BSONSerializeOptions): BSONSerializeOptions {
|
|
88
|
+
const {
|
|
89
|
+
fieldsAsRaw,
|
|
90
|
+
useBigInt64,
|
|
91
|
+
promoteValues,
|
|
92
|
+
promoteBuffers,
|
|
93
|
+
promoteLongs,
|
|
94
|
+
serializeFunctions,
|
|
95
|
+
ignoreUndefined,
|
|
96
|
+
bsonRegExp,
|
|
97
|
+
raw,
|
|
98
|
+
enableUtf8Validation
|
|
99
|
+
} = options;
|
|
100
|
+
return {
|
|
101
|
+
fieldsAsRaw,
|
|
102
|
+
useBigInt64,
|
|
103
|
+
promoteValues,
|
|
104
|
+
promoteBuffers,
|
|
105
|
+
promoteLongs,
|
|
106
|
+
serializeFunctions,
|
|
107
|
+
ignoreUndefined,
|
|
108
|
+
bsonRegExp,
|
|
109
|
+
raw,
|
|
110
|
+
enableUtf8Validation
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Merge the given BSONSerializeOptions, preferring options over the parent's options, and
|
|
116
|
+
* substituting defaults for values not set.
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export function resolveBSONOptions(
|
|
121
|
+
options?: BSONSerializeOptions,
|
|
122
|
+
parent?: { bsonOptions?: BSONSerializeOptions }
|
|
123
|
+
): BSONSerializeOptions {
|
|
124
|
+
const parentOptions = parent?.bsonOptions;
|
|
125
|
+
return {
|
|
126
|
+
raw: options?.raw ?? parentOptions?.raw ?? false,
|
|
127
|
+
useBigInt64: options?.useBigInt64 ?? parentOptions?.useBigInt64 ?? false,
|
|
128
|
+
promoteLongs: options?.promoteLongs ?? parentOptions?.promoteLongs ?? true,
|
|
129
|
+
promoteValues: options?.promoteValues ?? parentOptions?.promoteValues ?? true,
|
|
130
|
+
promoteBuffers: options?.promoteBuffers ?? parentOptions?.promoteBuffers ?? false,
|
|
131
|
+
ignoreUndefined: options?.ignoreUndefined ?? parentOptions?.ignoreUndefined ?? false,
|
|
132
|
+
bsonRegExp: options?.bsonRegExp ?? parentOptions?.bsonRegExp ?? false,
|
|
133
|
+
serializeFunctions: options?.serializeFunctions ?? parentOptions?.serializeFunctions ?? false,
|
|
134
|
+
fieldsAsRaw: options?.fieldsAsRaw ?? parentOptions?.fieldsAsRaw ?? {},
|
|
135
|
+
enableUtf8Validation:
|
|
136
|
+
options?.enableUtf8Validation ?? parentOptions?.enableUtf8Validation ?? true
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** @internal */
|
|
141
|
+
export function parseUtf8ValidationOption(options?: { enableUtf8Validation?: boolean }): {
|
|
142
|
+
utf8: { writeErrors: false } | false;
|
|
143
|
+
} {
|
|
144
|
+
const enableUtf8Validation = options?.enableUtf8Validation;
|
|
145
|
+
if (enableUtf8Validation === false) {
|
|
146
|
+
return { utf8: false };
|
|
147
|
+
}
|
|
148
|
+
return { utf8: { writeErrors: false } };
|
|
149
|
+
}
|